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

Author Topic: TGUI: a c++ GUI for SFML (with Form Builder)  (Read 287567 times)

0 Members and 5 Guests are viewing this topic.

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #45 on: May 20, 2012, 12:47:35 pm »
Quote
if I create a TGUI window, I can use it in the same way I would use a SFML one?
Yes, my window is just a wrapper around sf::RenderWindow, so you can still use all its functions.
But you will still have to link with sfml, linking to only tgui isn't enough.

Quote
What if I want to use stuff such as SFML/Network.hpp, or even OpenGL?
For networking or audio there is no problem at all. You can use it in exactly the same way as when you aren"t using TGUI.
I am not sure about OpenGL. I never tested it so I can't tell you if it would work.
If you use it correctly it will probably work but I will test it in the future to be sure.

Quote
Is it possible to change the textures/colors if I don't like the default ones?
Absolutely. The colors can be changed by calling a function like setTextColor, setBackgroundColor or changeColors (look at the example code where the combo box is created).
Changing the images is simply a matter of passing a different pathname to the load function.
Just copy the Black folder, rename the new one to what you want, edit the images in it and pass the new pathname to the load function.
It might be a little hard to understand the image filenames and the info.txt file in the beginning, but if you have any questions I will be here to answer them.
TGUI: C++ SFML GUI

argoneus

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #46 on: May 20, 2012, 01:52:02 pm »
...

Thank you very much! That covered everything :)

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #47 on: June 25, 2012, 04:09:46 pm »
I got good news: the TextBox is now working.
The only thing that is still missing is word wrap, but that will be for later.

Example code on how to use the TextBox:
tgui::TextBox* textBox = window.addTextBox();
textBox->load(280, 160, 30); // Width, height, text size, (optional scrollbar pathname)
textBox->setPosition(440, 400); // Set the position of the TextBox
textBox->setBorders(4, 4, 4, 4); // Add a border of 4 pixels on every side
textBox->setText("This is the text that will be displayed inside the TextBox.");
   
// To change the colors, simply call changeColors (the function has more optional parameters)
textBox->changeColors(sf::Color::White, sf::Color::Black); // background color, text color
« Last Edit: June 28, 2012, 04:11:33 pm by texus »
TGUI: C++ SFML GUI

noobie

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #48 on: June 28, 2012, 11:01:33 pm »
The GUI looks nice and the code is easy to understand.

I tested SFGUI and TGUI.
On my Windows 7 PC (30% lesser CPU usage then SFGUI? -> Without the sf::sleep(sf::milliseconds(100)); in TGUI Loop).

Why this? is SFGUI to complex? Or because of RenderWindow slower? Or just my imagination? :)

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #49 on: June 28, 2012, 11:49:50 pm »
I have no idea why this would be, but I think it will depend on the situation. I doubt that sfgui would be slower than tgui.
TGUI: C++ SFML GUI

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #50 on: June 29, 2012, 01:40:56 am »
The GUI looks nice and the code is easy to understand.

I tested SFGUI and TGUI.
On my Windows 7 PC (30% lesser CPU usage then SFGUI? -> Without the sf::sleep(sf::milliseconds(100)); in TGUI Loop).

Why this? is SFGUI to complex? Or because of RenderWindow slower? Or just my imagination? :)
On the contrary. You see more CPU usage with SFGUI because indeed more CPU time is being used because we optimized the library to the point where we offload certain portions of the processing from the GPU to the CPU and therefore the CPU and GPU times are equal. Search for my many other posts and you will see my statements about how SFML is bottlenecked by GPU processing power and bus transfer bandwidth. We eliminate this in SFGUI and so the application will pump out more frames per second but also make more use of the CPU which is expected. You can test this by observing the framerate of your test benchmark for both libraries.

It might be possible that at a lower widget count the overhead that SFGUI is associated with won't make it worth using, however it is amortized at higher, more typical widget counts which is what we optimized for.
« Last Edit: June 29, 2012, 01:43:55 am by binary1248 »
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Tresky

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #51 on: July 01, 2012, 08:08:33 pm »
If this feature doesn't already exist, it would be nice to have a picture button. If you add that, I will totally use this GUI.

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #52 on: July 01, 2012, 08:26:39 pm »
My Picture class can give a callback when clicking on it, if that is what you mean.
TGUI: C++ SFML GUI

Tresky

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #53 on: July 01, 2012, 08:43:39 pm »
So, in other words, the picture class can be used as a button?

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #54 on: July 01, 2012, 08:48:18 pm »
Yes.

The difference with the Button class is that a button can change its image on mouse hover or mouse down, while the Picture is just one image that can (if you want it to) send a callback on mouse click.
A Button is also able to send a callback when it is focused and you would press the space bar or the return key.
TGUI: C++ SFML GUI

Tresky

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #55 on: July 01, 2012, 08:58:20 pm »
Sweet. This system looks very promising. You've got my vote.

lejar

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #56 on: July 07, 2012, 08:49:41 pm »
Hi. I did a little looking at the documentation that you have and I couldn't really devise a way to make the text boxes lose focus when you click out of them. Am I missing something? Aside from that I've been enjoying using your library.

Thanks.

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #57 on: July 07, 2012, 09:02:21 pm »
The text box (and any other object) will only lose focus when focusing another object (by clicking on them or by using the tab key).
I will look into it, if it is easy to solve (which it probably is) then I will fix it within the next few days.
TGUI: C++ SFML GUI

gorgoroth666

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • RiseAgain
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #58 on: July 13, 2012, 02:03:29 pm »
Hi texus,

i played around TGUI a bit and I like it very much.

I created some control skins and I plan to write
simple game development articles using it.

Keep up the good work.
« Last Edit: July 13, 2012, 02:06:33 pm by gorgoroth666 »

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: TGUI: a c++ GUI for SFML (with Form Builder)
« Reply #59 on: July 13, 2012, 02:12:02 pm »
I am happy that you like it.
TGUI: C++ SFML GUI

 

anything