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

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

0 Members and 1 Guest are viewing this topic.

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #15 on: September 21, 2015, 07:03:20 pm »
alright, so tonight I have like 30 things to change to get all my pictures working XD

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #16 on: September 22, 2015, 03:35:03 am »
Alright, quick question though how are callbacks now done?

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #17 on: September 22, 2015, 06:14:53 am »
You should just check the tutorials to figure out how to get started.
- Introduction to signals
- Unbound optional parameters in signals (limited compiler support)
- connectEx function (alternative to optional parameters)
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #18 on: October 02, 2015, 10:18:34 pm »
ya I got it all working now, and being able to change the textures of pictures is awesome.  Can now show what pictures are disabled and which aren't.

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #19 on: April 04, 2016, 10:56:40 pm »
TGUI 0.7.0 has been released.
The changes done after the alpha versions were mostly bug fixes though.

Although originally the plan was to release a beta version first with many new changes, I have decided to split it in two versions. The changes for the beta version were becoming too big, so these changes will eventually be released as v0.8 instead of delaying the release of 0.7 another two years.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9084
    • View Profile
    • development blog
    • Email
AW: TGUI: GUI library for SFML
« Reply #20 on: April 05, 2016, 02:21:57 pm »
What are the major changes? :)
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #21 on: April 05, 2016, 02:46:36 pm »
Compared to 0.6, so many things have changed that I stopped writing them down. The really important ones are mentioned in the changelog, but practically everything changed during the last two years.

The biggest changes were already done with the release of 0.7-alpha1 (when this topic was created). Afterwards there have been mostly minor improvements and bug fixes. I'm sure there have to be some nice improvements in the last 150 commits, but I quickly scrolled through them yesterday without finding anything important enough to mention.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #22 on: June 12, 2016, 06:10:48 pm »
TGUI 0.7.1 has been released.

All textures used to be loaded from a file while only the Picture class could be constructed from an sf::Texture. There was a way to change how textures were loaded and e.g. load them all from memory but this impacted any texture that you tried to load. Now it is possible to pass an sf::Texture anywhere where you need a texture in a widget. You can even pass only part of such a texture, e.g. the following code sets the center part of a 400x300 texure in the Picture class (40 pixels from left and right and 30 pixels from top and bottom are cropped).
picture->setTexture({sfTexture, {40, 30, 320, 340}});

The Layout class could previously not handle string literals because it would cause ambiguity when passing 0. This issue has been worked around and you thus no longer need to construct an std::string by putting braces behind the strings. The following code
button->setSize({"0.6 * parent.width", "0.2 * parent.height"});
can now thus be written as
button->setSize("0.6 * parent.width", "0.2 * parent.height");

Adding new lines to the ChatBox widget was extemely slow. It should now be about 15 times faster.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

jill

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #23 on: June 26, 2016, 06:38:09 am »
I just taste it and feel good. If tgui is used to write desktop windowing applications

jill

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #24 on: July 03, 2016, 02:59:18 pm »
Hello, the tgui program running failed with "Abort trap (core dumped)" when it runs to connect() or the tgui::Theme::load calling on FreeBSD.
It is srange that the connect() call will pass without extra parameters (Only set the signal name and the callback function).

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #25 on: July 03, 2016, 03:01:20 pm »
Could you show a minimal code example (something that I can just copy-paste and run) that gives this error?
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

jill

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #26 on: July 03, 2016, 03:11:42 pm »
Could you show a minimal code example (something that I can just copy-paste and run) that gives this error?

This happened on the example code from the tgui-0.7.1.zip and also to my own code.
Here its an example:

// main.cpp
#include <TGUI/TGUI.hpp>
#include <cstdlib>

void callback(std::string message) {
        std::cerr << message << std::endl;
        std::exit(EXIT_SUCCESS);
}

int main() {
        sf::RenderWindow window(sf::VideoMode(640, 400), "tgui & freebsd");
        tgui::Gui gui(window);
        gui.setFont("/usr/local/share/fonts/dejavu/DejaVuSansMono.ttf");

        auto button1 = std::make_shared<tgui::Button>();
        button1->setSize(100, 30);
        button1->setPosition(300, 150);
        button1->setText("Click Me");
        std::cerr << "d1" << std::endl;
        button1->connect("ExitButton", callback, "Exit Message");
        std::cerr << "d2" << std::endl;
        gui.add(button1);

        while (window.isOpen()) {
                sf::Event event;
                while (window.pollEvent(event)) {
                        if (event.type == sf::Event::Closed) {
                                window.close();
                        }
                        gui.handleEvent(event);
                }
                window.clear();
                gui.draw();
                window.display();
        }
        return 0;
}
 

// Makefile
Code: [Select]
PROG=app
SRCS=main.cpp
MAN=

LIBS=sfml-graphics gl
CXXFLAGS+=`pkgconf --cflags ${LIBS}` -std=c++1z
LDFLAGS+=`pkgconf --libs ${LIBS}` -lc++ -lm -lthr -ltgui

.include <bsd.prog.mk>

Build and Run:
Code: [Select]
$ make                                                                                                         
$ ./app
d1
Abort trap (core dumped)
« Last Edit: July 03, 2016, 03:27:12 pm by jill »

texus

  • Sr. Member
  • ****
  • Posts: 469
    • View Profile
    • TGUI
    • Email
Re: TGUI: GUI library for SFML
« Reply #27 on: July 03, 2016, 03:26:58 pm »
The first parameter to the connect function has to be the signal you want to receive. Since you want to receive the callback when the button is pressed, the first parameter has to be "Pressed" (case-insensitive) and not an arbitrary chosen name like "ExitButton".

If I run this code on linux it prints the following which is much more clear than getting "Abort trap (core dumped)":
Code: [Select]
terminate called after throwing an instance of 'tgui::Exception'
    what(): cannot connect to unknown signal 'ExitButton'.

I'm starting to feel like I'm the only person who gets such a clear message when the program terminated due to an exception so I'll update the example codes soon to include a try-catch block.
TGUI: C++ SFML GUI
TGUI.Net: C# binding for TGUI

jill

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #28 on: July 03, 2016, 03:32:32 pm »
To Texus:

OK, thank you. That's it.

JPB515

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: TGUI: GUI library for SFML
« Reply #29 on: July 19, 2016, 12:57:48 pm »
Hi,

Just started using tgui for a project and run into a problem. I keep being told that tgui-s-d.lib is too large to push to GitHub! It is reported by git as 105.59MB, whilst the limit is 100MB. I can't quite believe that I'm the first person to run into this, so is there a solution?