I was working on some GUI stuff to use in my SFML projects, and it ended up turning into a decent object oriented GUI toolkit. It's object oriented, and extremely easy to use.
I figured it might be useful to people, so I'm going to release it under the zlib/libpng license like SFML. It is called cpGUI, and it's based on SFML version 1.5.
It includes the following controls:
* Normal highlightable Buttons with a text label
* Image Buttons that are based on an sf::Image
* Shape Buttons that take an sf::Shape and turn it into a clickable button
* Check Boxes
* Selection Boxes with the ability to add choices. It uses a scroll bar when necessary
* Drop Down Boxes with the ability to add choices and set maximum depth. A scroll bar is used when you reach your maximum depth.
* Text Input Boxes - a one line box for inputting text. It has a blinking caret, but it is non-editable
* Text Boxes for loading a simple text file and displaying it. The Text Box will automatically word wrap the text according to the size of the box you create. This is useful for displaying instructions or licensing info. Text Boxes are non-editable and read only.
* A GuiContainer class that contains all of your objects - used for setting focus, and also some other things under the hood.
Almost all of the work is done for you, and it is very simple to use. In most of the controls, you can easily customize the colors, fonts, size, & position. Each object can return its state and tell you if the mouse enters or exits the control, and can tell you if the button was clicked or if it's down.
If anyone is interested, I can upload it and put it in the wiki when I have time. I'll post a screen shot that includes all of the available controls. If I post the files in the wiki, I'll include the example code for the screen shot with lots of comments explaining how to use cpGUI.
Update:I have added a built-in font manager to help save on resources. Now, rather than having a separate font for each object, new fonts are only loaded when necessary. Also, when a font is no longer used by any object, it is automatically deleted. Other than cpGUI's default font, you will never have an unused font in memory.
This is all automatic, and it doesn't change how cpGUI is used.
Thanks to “Meltra Bour” for pointing out the need on the forums. Thanks to “l0calh05t” & “Wavesonics” for helping me learn how to implement this.
**Major Update** - 9/28/9
See
this post for details. Includes functions for setting mouseover color, bug fixes, and separate files to include only the controls you need for your project.
**Update** - 9/29/09
See
this post for details. Update includes various tweaks, bug fixes, and now cpGUI has static libraries.
You can download the latest update in the
Projects section of the Wiki.