By jlnr (dev)
Date 2014-11-14 04:56
I think most games just write their menu & HUD code from scratch. I think the key to implementing any kind of GUI is to segment your apps into "states" or "scenes" so that you don't end up with the messiness of seven different menus in a single Window subclass. Most games in the Gosu Exchange forum should get this right, so you can look at them.
And if you need a complete GUI toolkit because your app needs more than plain buttons, you can always fork and improve either of the existing GUI libraries. The next user might appreciate it :)
By jahmaican
Date 2014-11-14 08:33
Edited 2014-11-14 08:40
Making GUIs is actually quite straightforward so you should go ahead and try doing it your way. First, think what elements you need, and then just write it how you feel it.
For example, if you need a dialog box, it needs a state for it - and then you can have a method for invoking a dialog in game, i.e. game pauses and the box with given contents is shown on top.
Then, to let user actually do something, you need a concept of button (that has some text on it and a certain action), and then a concept of the action itself. E.g. there will be a 'Cancel' button, that invokes 'cancel' action when clicked, and this action does nothing but return to previous state.
Of course there's more than one way to implement the above and you can hardly go wrong with such simple stuff, so again - do it how you feel it and then think if it makes sense. Eventually you will end up with a piece of code that does exactly what you need, and not "everything that anyone could ever need".
On a not-so-relevant thought, I played with actual ruby GUI libraries once and turns out you can easily use gosu and wx together (meaning you can have separate gosu window and wx app and they can communicate in real time).
> and gglib, but are they still in development or have they faded away?I read the
thread about gglib and was really interested to try the 2.0 version. But I couldn't find it anywhere. The source code location, gglib.googlecode.com, looks to be gone. There's a
1.3.0 version on RubyGems, but it's clearly not the newest (May 2009, versus the April 2011 date on that newest post). There's also a
GitHub project, but it's empty.
psadda, are you still around?
I can build my own widgets one at a time, but it seems a shame, if someone else has already forged the path. Plus, I know my strengths, and UI design ain't one of them.