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.
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.