For a while now, I have been wanting to create my own GUI "library" in C++ and DirectX 9. I have seen a ton of questions regarding GUIs, but what I want is a GUI specific to games. Most libraries are really complex and are very generic, and they offer support for command line parsing and window creation etc. These libraries don't suit my needs, so I want to write my own. The only problem is I don't know where to start.
I have no idea how to build a framework/foundation for the library. I don't know how to make the GUI elements/objects communicate with each other and how to handle events. I also have no idea how to manage the graphics of the GUI. For example, do I give the programmer full responsibility over how the GUI looks, or do I create a default design? Do I then store store a separate file for the design of a button, textbox, label, combobox etc.?
I would also like to point out that I plan on my GUI in fullscreen mode only, and that I only want to support basic elements like buttons, textboxes, static labels etc. And that I would like to be able to create a HUD with the library. I know that I am asking to many questions, but I have never tried to create anything this complicated.
If you have no idea about all those things, I would recommend you don't write your own GUI from scratch. (I actually did write my own game GUI from scratch, and I kind of regret it -- what I ended up with was kind of half-baked and I'm sure there are better options around.)
But I do get what you mean: You don't want to use a standard GUI toolkit because then it won't "feel" like a game. The good news is, there are existing GUI toolkits out there specifically designed for games. The most popular one appears to be CEGUI (Crazy Eddie's GUI System). As you can see from their website, it looks quite skinnable and doesn't seem like a Windows app at all.
I haven't used it, but I'd recommend looking into it before you go designing your own.
Writing your own gui would be a good educational task, as you will soon have to learn the design patterns that are used to make it scalable. If you are interested, the GoF book uses GUI as an example to many of the patterns.
However, it is a large (HUGE - I mean years of your life) task to do it properly.
One project that might interest you, however, is the cIMG library. This is an image processing libary rather than a gui library. It doesn't support buttons or any such like, but it does do rather low level drawing which might be closer to your final goal (it doesn't outsource its imaging to a gui/graphics library). It is also a header only library, with all code in a single header file, and so fairly easy to have a peek at.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With