I'm using GBUI now. But I wanted to know how to make my own GUI (in case I need to later.) I've looked around and read some people making their own. Could someone drop a link or write down the general steps to making your own GUI? Thanks
Mine is just a very simple system based a simple node structure and ortho quads.
I figured if I don't need any sophisticated elements then I have everything I need:
- I can get the coordinates and clicks of the mouse with standard jME methods.
- I can draw elements wih any appearence at all by putting a texture on a quad.
- I can position the quad on the screen easily in ortho mode.
So I have a container class which has basic information such as (x,y,width,height) and a list of children, which are also containers - much like nodes in jME.
It also has methods such as getPosition, which will give you it's position taking into account the parent's position.
I make one container for the screen then arrange everything under that.
Continer has methods like onClick and onHover. When the mouse does something the event is sent to the top level container and if it happened inside that container, it is checked against each child.
The frontmost element that it lay within then handles the event.
Containers have no visual representation and don't respond to events - so they are subclassed for visible elements.
For example, to display my banner I use TextureContainer. It's just a container with a textured quad attached.
For buttons I use a texture container which sends an event when it receives a mouse click.
That's about it really. If I needed much more I would probably use a GUI library.
Thanks for the reply alric. I will do this later this week. 8)