Designing a game-orientated GUI library

Started by
20 comments, last by Bob Janova 18 years ago
Quote:
Telastyn: Because I don't need right clicking. When was the last time you had to right click in (say) Doom3? With no need for context menus the right clicking is largely unused.


But when was the last time you had to right click in say... Civ IV? Different games have different needs. If you want to use it in 'lots of different games' the need will come up. Given the triviality of including it, it just seems a little silly not to, imo.
Advertisement
Eep! Can you use the [ source ] [ /source ] tags please Guimo? Thanks [smile] Nice design by the way
Quote:Writing the GUI is always a tedious process, so I'd like to share as much of the code as possible.


Yes it is... I have written 2 GUI libs in past, one of them being especially complicated, and found it really tedious and boring at times. However, the ability to develop UI for games with very little work absolutely recompensed my efforts.

OrangyTang, have you thought about writing this kind of library not only for you, but also for other people? I ask, since I am really interested in writing one open-source / portable / C++ / flexible / rather simple / GUI library for game programmers, and it would be good to work together.

You may say that there are literally thousends of other GUI libraries out there on the internet, so why won't you join them or start your own? The facts are, your design is very similar to what I thought about how my next GUI lib should look like. So, are you interested in creating such "general purpose" (but not too general, ie. kitchen sink not included) GUI library with me (at least, since Deffer was also interested in writing one with me). I applied for Google Summer of Code 2005 with my "GUI library targeted at game programming", but was rejected (probably due to the fact, that Blender group didn't want such useless thing coded for them ;-) ) and from that time, had no time to start working on it on my own (uni, other projects etc. take time), but I am still very interested in writing one.


Anyway, my comments about your lib:

+ add: XML used for storing widget properties
+ add: WYSIWYG layout editor which allows to drag n' drop controls, edit properties etc.; I found that having even very simple layout editor makes implementing UI much easier task; what's more, it could be implemented using this GUI
+ it's good you don't want to implement automatic layout packers - I found them rather useless for games, since usually you DO want to have absolute control of your widgets
+ things to strive for: flexibility, RAD, ease of use (for developer), portability
+ flexibility: easy way to add new controls (ie. specific to game), ability to subclass other ones
+ abstract interface for every used external library, so that they can be easily changed to others (ie. SDL render things too slow for you, so you write OpenGL plugin)
+ skins
+ add: resolution independent control positioning / scaling!
- missing widgets: floating windows, drop-down lists, key binders
- I second Telastyn - adding the right-click ability is next to trivial, but it does have some very interesting effects
? you didn't write anything about communication GUI <-> programmer... callbacks, generic functors, sockets and signals or what?
According to your feature list you're planning to rewrite cegui (www.cegui.org)
This is what I've done with the GUI system in my own game. It works great (draggable dialogs are a bit wonky but otherwise...). I highly recommend going this route in terms of configuration... it might require a bit more work initially but the results are highly worth it :)

<?xml version="1.0" encoding="UTF-8"?><!-- Desktop --><desktop>	<!-- Dialog -->	<window type="dialog">		<caption>Quit?</caption>		<x>256</x>		<y>128</y>		<width>256</width>		<height>128</height>		<color red="255" green="255" blue="" alpha="255" />		<visible>1</visible>		<mousedetect>1</mousedetect>		<movable>1</movable>		<background>91</background>				<!-- Static Text -->		<window type="statictext">			<caption>Are you sure you wish to quit?</caption>			<x>0</x>			<y>40</y>			<width>256</width>			<height>16</height>			<color red="255" green="255" blue="" alpha="255" />			<visible>1</visible>			<mousedetect>1</mousedetect>			<font>tahoma</font>			<justify>1</justify>			<textwidth>256</textwidth>		</window>		<window type="button">				<caption>Yes</caption>				<x>55</x>			<y>67</y>			<width>64</width>			<height>32</height>						<color red="255" green="255" blue="" alpha="255" />				<visible>1</visible>			<mousedetect>1</mousedetect>			<tile idle="94" mouseover="94" click="95" attention="94" />			<font>tahoma</font>					</window>				<window type="button">				<caption>No</caption>				<x>135</x>			<y>67</y>			<width>64</width>			<height>32</height>						<color red="255" green="255" blue="" alpha="255" />				<visible>1</visible>			<mousedetect>1</mousedetect>			<tile idle="94" mouseover="94" click="95" attention="94" />			<font>tahoma</font>					</window>			</window>	</desktop>

Quote:Original post by Anonymous Poster
According to your feature list you're planning to rewrite cegui (www.cegui.org)

404.

www.cegui.org.uk
Quote:Original post by playmesumch00ns
www.cegui.org.uk


Crazy Eddie's GUI System is pretty nice, but it's a little too much in my opinion, especially considering the OP's needs. It also seems like there will never be a final release for it.

I haven't had much luck with the library myself. It's too bulky for my needs (its inclusion of other libraries, its attempt at supporting every type of control, etc.), and when I tried integrating it into one of my projects it would cause the application to crash when exiting. So after a few days of moving things around to get it to fit sungly in my library, I just ripped it right out [lol].

I'm writing a library to use in making simple 2D games, which includes a GUI along the same lines as the one you describe, but at this rate, I wouldn't count on it ever being finished [lol].

Writing a GUI is a little tedious at times, but overall I think it's pretty fun. It's one of the few systems that lends itself so easily to OOP, that once you've got the base classes in shape, the rest just rolls right along.

As a side note, it's really easy to try and support too much once you start writing a GUI. If you decide to write one yourself, I advise you to keep it as simple as possible, despite all tempatations.
Bob Janova: maybe you could write a small tutorial. I think there is a lot of interest in this subject and a lot of people would benefit from it.
Your explanation is ok but it would still take some time to figure out the details.
I know there are some resources already there like the article Mason McCuskey wrote or Chad's tutorials. However both of them are far from being simple. It takes a while to go over and pick up the good parts.

[Edited by - Calin on April 7, 2006 3:15:37 PM]

My project`s facebook page is “DreamLand Page”

How's this going then?

This topic is closed to new replies.

Advertisement