Daniel J. Petersen’s Devblog

Documenting my struggle to make a videogame.

Three Day Weekend

I went to sleep at 7 PM last night, and woke up this morning at 9.30. I’ve got a three day weekend, I’ve got 14 hours of solid rest, and I’m ready to get shit done on It Always Ends In Nuclear War.

The biggest thing holding me back has been lack of a good GUI library. A lot of the game will come through interacting with the GUI, so it has to be easy and quick for me to iterate by adding / moving components around. It also has to look half-way decent to the end user. I’ve looked into third party GUI libraries in the past, and it’s been rough. I wasn’t sold on anything that I saw, so I opted to see how it would be making my own GUI from scratch.

It’s been okay. I’ve lovingly titled the GUI system I’ve been making SubGUI. I’ve got a button widget, radio button widget, a navbar, a progress bar, dialogue box, message box (dialogue box being a popup window where you click okay to dissmiss, messagebox being an area of the screen where messages appear / fade away after a certain amount of time), and an initial version of a slider. I’ve basically been making widgets as I needed. I’ve run into two main problems, though.

The first was blurry text. I narrowed it down to using antialiasing. Apparently if I had antialiasing turned on, the text also gets smoothed out, which is pretty terrible. I solved that problem by drawing the text on a RenderTexture off screen instead of directly to the window. The text still doesn’t seem as crisp as it does in a web browser, but I feel like it’s crisp enough, and if I spend some more time on it I’m sure it’s a solvable problem.

The other thing of concern has been how to handle the layout, which I had been doing manually. Each widget has an onResize method, and I define how it positions itself / sizes itself there. This works, but it’s a huge pain in the ass, and I don’t want to keep going down this route.

The way I see it, I have two options. I can either look into third party libraries once again, or I can try my hand at seeing if I can come up with something that automatically lays out my components in a reasonable way.

The path of least resistence is to look into third party libraries / frameworks, which I’ve been doing the past week or two. It’s been rough. I don’t want to deal with working in another language, so that means only C++ libraries / frameworks. I’ve considered in one way or another qt, wxFrameworks, gwen, imgui, myGUI, crazy eddies, gtk, using chromium to build the GUI with web tools (html, css, js), guichan, otterUI, SFGUI, and turbo badger. Out of all of them I liked imgui the most, but I wasn’t sold on any of them.

I’ve decided that I’m going to go ahead and do the stupid thing, which is to make a layout engine and continue to create my own GUI widgets. I started to implement it on Thursday, and I think it’s reasonable. I’ve got a design for the layout API, a decent idea on how it should behave, and three days to make it happen. I’m actually hoping to finish the layout manager early, and work on adding more components to the framework, but I’ll be happy enough if I come out of this weekend having something which does automatic layout in a reasonable fashion.