Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFInterface - Yet another GUI library  (Read 2422 times)

0 Members and 1 Guest are viewing this topic.

JayhawkZombie

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
SFInterface - Yet another GUI library
« on: July 24, 2016, 11:07:09 pm »
I see it's been done quite a few times already, but I've been working on a GUI library using SFML.
I've kept the github repo private so far until it's in a more stable state, but I wanted to post here and see what people here thought.

Current Features

  • (Attempt) at a unified, default design.  More inspired by "modern" UIs
  • Animations, though it's in progress.  Set times for animations and infinite-looping animations work.
  • Custom callbacks
  • Extendable elements
  • Texturing
  • Clipping. Nothing inside an element will render outside of its bounds

Working On

  • Drop-down lists
  • Sliders
  • Multi-threaded implementation.  It "works", but it could be cleaner.
    • This is mainly to prevent users from making the app appear unresponsive by doing heavy workloads in the same thread (no more "Not Responding" if they do a ton of work in the main thread)
  • Custom shaders.  Sort of low on priority list
  • Resource manager


Obviously plenty of stuff still needs to be done, like fully handling resize events.  Everything that is rendered will stretch, but the collision goes kinda wonky.
You can derive from any of the built-in elements, as long as you override the 'render' function.  This may become optional in the future.

All event handlers have default actions that always get called, then there are additional rebindable callbacks you can register for an event (but you certainly don't have to, you can choose to do nothing).
The caveat is that these have to accept certain parameters.  I may change this in the future if I find a good way to do it.

You can take focus of the UI, if you wanted the user to be forced to interact with something in order to continue.  You can release focus, too, as well you should.

I would consider this pre-alpha, but I wanted to get input from people about features/appearance.  I'm the kind of person that can be incredibly picky about a UI that I use.  Anything too flashy/distracting is a huge negative to me.  Ignore the bright red circles, that's playing with infinite-looping animations.

You can change the speed/duration of animations dynamically.  It's timed using high_resolution_clock. Currently this is done by telling each element how long it has been since they were last rendered, but it's up to the element to determine if it's been long enough to update its animation.  I plan on changing this so the element doesn't need to worry about that.

There's a managing "Controller" class that has access to everything in the BaseElement class, so many of these changes shouldn't be too hard to implement.

Example (because I'm still keeping the repo private until it's ready to be used by others):

auto checkbox = SFInterface::CheckBox::Create(); //Yes, inspired by one of the favorite libraries here
checkbox->setSize(sf::Vector2f(100, 50));
checkbox->setPosition(sf::Vector2f(10, 200));
checkbox->setTextSize(10);
....
controller.add(checkbox);
 

Elements have default text/color attributes, so you don't necessarily have to change them.

Here's a small screenshot of a few elements on the screen:
http://imgur.com/a/TJOt1

The default graphics are vector graphics, recomputed whenever you adjust the size, so they won't get fuzzy even if they're really large.  Curved items are in the works, but smaller items would require fewer computations to resize.
The fonts sometimes go kind of fuzzy, but I'm working on that.  I'll probably have to use another font.

Ultimately, the custom shaders would be easy to use, nothing needing to write one yourself.

So, some questions, maybe.
If you were to use it, what sorts of things would you like handled automatically and what things would you like to be able to handle on your own?
I know what I would do, but I'm the one making this.

Improvements you might suggest? Features you might suggest?

Note, though, I'm a sole programmer.  There's no large team working on this.  I also really only have a Windows machine currently to test it, so Linux support isn't planned until later.