I moved to a new URL! Check it out!

Dev Log: GUI Stuff

Dev Log: GUI Stuff
I've been making some good progress on my latest prototype over the past few days. I got a quick GUI system working in the game but then quickly realized that my approach was pretty bad. After reading up on some articles written about making simple lightweight GUI stuff for video games I scrapped almost all the code and rewrote it.

My first approach was just having each GUI Entity operate independently and that worked for a bunch of simple cases such as a single drag and drop item, or a button that does something when it's pressed. However doing things beyond that, such as multiselect, and having different GUI elements pass info along to one another, requires a different approach.

The approach I settled on for now is something I've done briefly before with a quick prototype a few months ago. I'm now electing to use a single "controller" class as the base of the GUI system. The controller has a list of all the GUI elements it's in charge of, and almost all of the logic for the system is handled inside the controller.

Image


A controller has a list of child elements that it controls, and each element can also have even more child elements added to it. The controller is the only element that receives input from the game, and anything resulting from that input is passed along to the appropriate element on the list of children.

I still have a little ways to go on a few things. I want to be able to get modal elements working so that I can do things like message boxes that have to be cleared before continuing and interruptions when important things happen. There are still a few bugs to sort out with clicking through elements and dragging stuff around, but so far I feel like my progress has been pretty great and I might have something playable way sooner than I thought!
new comment!

Post your comment!

Name
Email
Comment