Daniel J. Petersen’s Devblog

Documenting my struggle to make a videogame.

Still Working on the GUI

Work continues on the GUI system for It Always Ends In Nuclear War. In my last post I talked about how I was working on an automatic layout system so that I don’t have to worry about manually positioning GUI items on the screen. This was surprisingly hard to do, but I did come up with something that I’m happy with. It’s not the greatest thing in the world as I only have so much free time to do this, but it should definitely help me out in the future.

At the most basic level, I’m thinking of each GUI component as a rectangle that takes up space on the screen. The layout system just manipulates rectangles for me by positioning and sizing them based on properties that I define for the rectangles. So if for whatever reason I want a GUI component to span half of its container in width, and all of its container in height (a container the size of the screen is always the top most container), be anchored to the left edge of its container with an offset of however many pixels, be centered vertically, as well as have constraints on the size (min/max width and height), I can do that really easily. The cool thing is that each GUI component can have other GUI components as children, allowing me to embed and use these position properties inside other GUI components.

I’m going to be working on the GUI system until it’s finished. I very much want to be done with this task and start work on the actual game again, but I think patience always pays off in the end. It should be worth it to have a good base so that I can quickly create / iterate on the GUI screens. In terms of components, at the moment I have a

I think that’s a pretty good list of things, but I still need to build out a tab container, dropdown list, input box for text, a list view, numeric spinner, and a color picker. I also want some way of making certain components scrollable. I have some vague ideas on how to go about making the components scrollable, but I’m not really sure how I’m going to do it yet.

I’m also trying to pick out color schemes for the GUI. I am not an artist, so I’m going to be going with plain colors / shapes instead of using premade images as a lot of games do. I’m thinking something simple like white text on a semi transparent background as shown here looks pretty good.