I want to bring up a topic that comes up alot of nothing ever seems to come of it. All real games need some sort of graphical GUI, I’ve notice alot of smaller game skirt around it by having no good GUI inside the game, just using AWT/Swing and whatnot before playing. But for any larger projects this doesn’t cut it. It’s not really a simple subject, I spose thats why there really isn’t code like this just floating around in the air, but I ask everyone to share at least what their ideal game would require of a GUI system.
I would require buttons/combo boxes/textfields-areas/scrollpanes for simple components and the ability to add moveable windows that hold those components that can be modal, I also expect to be able to add a button/whatnot directly to the screen without a window.
The heirarcy would be something like AWT but as simple as you could make it class wise. component-container-window. Where say a scrollpane extends container and adds/changes what it needs. I suspect you would end up having fired events much like AWT for internal as well as external use, a scrollpane could listen for focus events on it’s components and it could say, reposition it’s viewable area if that component wasn’t visible. (say it was focused programmicly instead of a click)
I would imagine you would have to listen for AWT events off a frame and send them to some sort of GUI manager that would see if that event is used up by the components. If not, the click or key press would be meant for the game and you could store it in some kinda keys[] down/up type deal so the game could just poll. The input is always tangled in this stuff one way or another.
Any thoughts on this? Or better yet, your code or an explaination of how it works? meh.