PGUI - GUI System for the BGE

Hello folks!

I’m working on a GUI system to be used within the Blender Game Engine.
Currently it’s on its BETA stage, that means that it works but it’s not perfect!
I’m using BGL to handle the drawing, BLF for the fonts (and also for the fancy text shadows :))
and VideoTexture to handle the images.

Here’s a list of supported components (or controls):

  • Button
  • CheckBox
  • Container (Panel)
  • BaseControl
  • DropDown
  • Image Viewer
  • Label
  • List Box
  • Progress Bar
  • RadioButton
  • Slider
  • Spinner
  • Edit Box (Text Edit)

The main feature is Component Skinning, you can make your own themes with your own textures.

EDIT:
New Features:

  • Layout System
  • New Event System

Here’s an example of a GUI without skins:
http://i.imgur.com/QnQdZU4.gif
http://i.imgur.com/v3Wpe0y.png
http://i.imgur.com/6ZwOTWT.png

Now this is how it looks like with a nice skin:
http://i.imgur.com/XDP31Xo.png

If you want to see it in action, here’s a video:

PS: Not everything works perfectly, like I said before, but you can make awesome GUIs with it :yes:

Docs: https://github.com/DCubix/PGUI/wiki
GitHub: https://github.com/DCubix/PGUI

Well, that’s it! Thanks for your attention! =)

This is really cool!

Is there any video tutor about it?

So I am on.
How i can find out what exactly is availible.
For Example:
How i place an Image?
How i change the Mousevent from Mouse_Hold to … lets say: Mouse_over or Mouse_Blur or Mouse_Out… ?
And… can i change Dynamicly?

Currently I’m still working on the docs.
But I will make some tutorials whenever I have the time :slight_smile:
And yes, everything can be changed dynamically!

:slight_smile:

Nice, cant wait to see it in action.

Can you put up the sources for those example UI shown in the images?
I am unable to get these to work:
Checkbox, RadioButton and VerticalScroll

And is there any variables that we could use to change the panel’s position in real-time?
so that we can drag the “Form” by mouse.

I’ve been using sender.bounds[0] and sender.bounds[1] but there seems to be a problem where the attached
components lags behind when the form is moved. Is there anyway around this?

Hi, I edited the first post with new info and a new video showing the current features of the GUI system. There’s also a Wiki being written! :slight_smile:

Just testing this out on my Mac with Blender 2.75. Had to change “pgui.py” in the src folder to “PGUI.py” to keep from getting: AttributeError: ‘module’ object has no attribute ‘PGUI’

Looking forward to testing further to keep me from having to develop my own gui from scratch.

@DownshiftDX
Thanks for the comment. :smiley:
pgui.py is supposed to be PGUI.py. But apparently GitHub doesn’t know the difference between lower case and upper case :stuck_out_tongue:

Here’s how the new GUI style looks like:
http://i.imgur.com/SHizAzZ.png

I also want to warn that the skinning system is currently broken due to VideoTexture issues. I hope they fix it soon!

I have an idea,

add the ability to draw these on the surface of faces,

so you can add widgets to vehicles, (dashboard)

or add a door lock, or ? unity does not even have these.

have you seen my 3d widgetry demo?

@BluePrintRandom
I’m doing some research on how to render the GUI onto a plane for example. (No success at all)
I tried VideoTexture, but I didn’t find anything helpful on the docs…
I was trying to find an old demo that I saw a looong time ago, It was a torus and you could draw on it, everything realtime on the BGE, that’s what I wanted.
Yes I saw your 3d widgetry demo, and it’s really nice!

@TwisterGE

Was there an update to pull with your changes to the GUI style?

@@DownshiftDX
Yes, it’s up on GitHub :slight_smile:

what about drawing your UI in a different scene and using render to texture

there is a example of using a camera in the same scene in resources,

@@BluePrintRandom
That’s a nice idea but how? I found the bge.texture.ImageViewport but that would require the scene to be overlayed and also would render the whole screen instead of the GUI…

Today I added tooltips for the widgets.
Also fixed some bugs.
http://i.imgur.com/QnQdZU4.gif

Allows the slider to change texture, eg: from new to old, for an interactive presentation?
Would be nice to see that!..

Its top notch work, how many lines would a user need to add
a dropdown?

import PGUI
added = PGUI.addElement(‘dropDown’,(bge.render.getWindowHeight()/4)*3,bge.render.getWindowWidth()/8, [“option1”,“option2”],[data1,data2],target)

??

If you can have it work on a face,
you could have usable computers in
game, I would use it to control friendly Ai.

@BluePrintRandom
Not so much :smiley:[SUB][/SUB]


from pgui import *
from bge import logic as g

def main(cont):
    o = cont.owner

    if "init" not in o:
        o["mgr"] = PManager.new()
        mgr = o["mgr"] # I don't wanna write o["mgr"] every single time :P
        
        ddown = mgr.addControl("myDropdownList", PDropDown.new(bounds=[140, 10, 90, 20], text="Language"))
        ddown.toolTipText = "Select a programming language from the list"
        ddown.items = ["Python", "Java", "C++", "Lua"]
        
        o["init"] = 1
        mgr.bind()
    else:
        o["mgr"].update()


I’m still thinking about how can I make 3D GUIs. I can’t promise anything but I’m trying my best :slight_smile: