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

Author Topic: TGUI: GUI library for SFML  (Read 15663 times)

0 Members and 1 Guest are viewing this topic.

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
TGUI: GUI library for SFML
« on: September 01, 2015, 02:47:25 am »
TGUI: Texus' Graphical User Interface

Easy to use
TGUI aims to be easy to use, with only a few lines you have a fully functioning TextBox on your screen.
tgui::TextBox::Ptr textbox = tgui::TextBox::create();
textbox->setPosition(100, 50);
textbox->setSize(300, 200);
textbox->setTextSize(16);
gui.add(textbox);

Customizable
The widgets can be created by just using colors or by using images, making the look very customizable.
When widgets are created without a theme then they will use the build-in white theme (top left image). TGUI also ships with ready to use Black and BabyBlue themes (top right and bottom right images).


(click images for larger version)

Cross-platform
TGUI tries to support the same operating systems as SFML, so it supports Windows, Linux, Mac OS X and FreeBSD and provides experimental support for Raspberry Pi, Android and iOS.


Installation tutorials are available for each of these systems.

Gui Builder
An experimental Gui Builder is included to allow easily creating and editing forms.


Unique callback system
Connecting signals is very easy:
void function() {};
button->connect("pressed", function);

But the system can detect certain parameters and fill them in with information about the event:
// str will contain the text from the button
void function2(std::string str) {};
button->connect("pressed", function2);
button->connect("pressed", [](const sf::String& str){});

Relative sizes and positions
Next to passing absolute values, you can specify positions and sizes relative to the parent.
checkbox->setPosition("30%", "20%");
editBox->setSize(400, "5%");

The widget position and size will automatically update when its parent resizes.



More information
For more information about the project, check the website which has tutorials, documentation and a few example codes. Source code can be found on GitHub.

If you have problems with getting tgui to work or if you find bugs then please open a topic on the TGUI forum.

Some images
 

 
« Last Edit: January 28, 2019, 08:31:56 pm by texus »
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

AxiomsofDominion

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #1 on: September 06, 2015, 08:27:18 pm »
I use TGUI for my current project and I'm pretty satisfied with v0.7-alpha1. No errors or any stability issues so far.

AlexAUT

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #2 on: September 07, 2015, 01:46:53 pm »
I used it quite some time ago and it was a great experience  :)

The only thing missing in my opinion are "layer/panel transition" effects like fadeIn fadeOut, swingIn/Out etc. They are not hard to implement as a user of the libary, nevertheless it would be a cool feature built into the library



AlexAUT

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #3 on: September 07, 2015, 03:04:12 pm »
I wouldn't really expect things like fading to be part of a gui library. But it seems to exist in wxWidgets.
I guess I could add showWithEffect and hideWithEffect to widgets (or even just add some optional parameters for the already existing show and hide functions), I'll look into it for the beta release or perhaps even already for alpha2.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #4 on: September 09, 2015, 09:03:38 pm »
Well this UI library has what I need clickable images so, will probably switch over to using this one.

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #5 on: September 10, 2015, 01:05:17 am »
Quote
The only thing missing in my opinion are "layer/panel transition" effects like fadeIn fadeOut, swingIn/Out etc. They are not hard to implement as a user of the libary, nevertheless it would be a cool feature built into the library
Animations on show or hide have now been added to


How to use it:
button->showWithEffect(tgui::ShowAnimationType::Fade, sf::milliseconds(500));

I'm planning on redesigning the animation class and moving it to the public interface in the future so that you can e.g. move a widget from one spot to another, but for now the animation class can only be accessed indirectly with the showWithEffect and hideWithEffect functions.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

AlexAUT

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #6 on: September 10, 2015, 08:33:45 am »
Looks nice  :D

You could get some ideas from this https://github.com/libgdx/libgdx/wiki/Scene2d#actions which is in my opinion a easy to use and flexible API.



AlexAUT

Blasphemer

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: TGUI: GUI library for SFML
« Reply #7 on: September 12, 2015, 07:20:11 pm »
I am using it in my project, its simple to integrate, easy to use and it works very well. Keep up the great work.  :)

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #8 on: September 18, 2015, 06:06:21 pm »
Any chance of you adding a way to change a picture, after one has already been loaded to a picture widget?
Asking cause I would love to gray out unable clickables till requirements have been met.

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #9 on: September 18, 2015, 06:10:23 pm »
I'll add a setTexture function to the Picture class in 0.7-alpha2 which should be released this weekend.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #10 on: September 18, 2015, 09:51:17 pm »
I'll add a setTexture function to the Picture class in 0.7-alpha2 which should be released this weekend.
Sweet thanks.  This should be alot more useful then me disabling and hiding the pictures instead like I currently am.

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #11 on: September 21, 2015, 02:41:46 pm »
TGUI 0.7-alpha2 has been released

Tool Tip
A tool tips can now be any widget and is no longer limited to a simple text. Check the tool tip tutorial for more info.


Show/Hide animations
You can use showWithEffect or hideWithEffect to make widgets appear or dissapear by fading or by sliding from the sides.


New theme
A TransparentGrey theme was added, I don't have any screenshots of it though. All widgets are semi-transparent in this theme and only use colors (no images).

Other changes
- The HorizontalLayout and VerticalLayout classes were fixed so you can now use them to stack your widgets next to each other or below each other.

- A setOpacity function was added which allows giving any widget a certain transparency (without the limitations of the old setTransparency function).

- Text auto-sizing was improved


There will be no more releases for some time, don't expect the beta release before July/August next year. An alpha3 version will only be released if important bugs are found before then.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

AlexAUT

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #12 on: September 21, 2015, 03:17:53 pm »
Nice and thanks for the implementation of the Animations!

Can't wait to use it in my next project



AlexAUT

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #13 on: September 21, 2015, 05:59:24 pm »
So let me get this right for this new version
tgui::blah::Ptr = theme->load()  instead of  tgui:blah::Ptr wtf(*gui)
and now have to add the parts to the gui

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #14 on: September 21, 2015, 06:22:06 pm »
If they are loaded from a theme file, yes.

The following two lines from v0.6:
tgui::Button::Ptr button(gui);
button->load("TGUI/widgets/Black.conf");

have basically been replaced with this in v0.7:
tgui::Button::Ptr button = theme->load("button");
gui.add(button);

Basically the same amount of code, but things get executed in a different order.

But some widgets don't have a theme (like Picture and Panel) and are loaded like below. Any widget can actually be loaded like this in which case it will just use the build-in White theme.
tgui::Xyz::Ptr widget = std::make_shared<tgui::Xyz>(/* optional parameters e.g. filename for Picture */);
gui.add(widget);
« Last Edit: September 21, 2015, 06:23:37 pm by texus »
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

 

anything