SFML community forums

General => SFML projects => Topic started by: hypnotix on May 29, 2016, 12:07:30 am

Title: Graphical User Interface Library
Post by: hypnotix on May 29, 2016, 12:07:30 am
TL;DR: https://github.com/shtgames/GUI-lib

I've spent the better part of the last three months working on a GUI library based on SFML.
I'm sure you're already rolling your eyes thinking: "Come on, another one of these?"
Well, I've been looking high and low and I haven't found one of those that's as practical and easy-to-use as what I wanted.
The whole design idea behind it is to create and define the interface with all the moving parts at the start of the program, setting textures, positions, colours, fonts, as well as, and here's the more important bit, setting the way in which every element should update itself and interact, if at all.
You'd then be able to have a clean, minimalistic main program loop that's nothing more than giving events to the GUI objects and drawing them, everything else is handled automatically the way you've defined it.
So, for instance, you'd give a TextArea an update function which returns the new string it should display, and it'll call that function and update itself often enough for humans to be incapable of seeing any lag.
You'd give a Button a void() function to call when an event specific to buttons; this would most often be, of course, telling it what to do upon being Released.
You can even set HoverMessages on most things, so that they display when the mouse enters the given object. After a certain delay, if you so desire, and naturally with optional and tweakable fade-in and fade-out animations.
Not only that, but you can even set individual parts of the text you'd give the HoverMessage to be with different colors or styles, as well as to update themselves independently of the rest of the text you've given.
All of the Buttons, ProgressBars, TextAreas etc. can be used as free-floating objects or, preferably, as parts of Windows which, in turn, can be stored in WindowManagers.
There's quite a lot more that I haven't covered, so please check it out and tell me what you think; you can find the library, compiled only on VS2015 for the moment, along with example code and accompanying resources, as well as some screenshots:
https://github.com/shtgames/GUI-lib
Title: Re: Graphical User Interface Library
Post by: Erdrick on May 29, 2016, 05:50:56 am
Congratulations on publishing this and thank you for including images of the GUI controls you created!

I think you could eventually expand your images to have an example of each kind of control, so people can get an idea of how they look in action, try them, and provide feedback.

Title: Re: Graphical User Interface Library
Post by: Sygmei on May 29, 2016, 05:34:14 pm
I love the way you build your windows :) Good luck
Title: Re: Graphical User Interface Library
Post by: hypnotix on May 29, 2016, 05:48:23 pm
I admit, it does seem a bit long and intimidating, but that's solely due to the lambdas. Otherwise, I think it's easier like this, by chaining functions.