Main Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - texus

If you no longer need objects then you can use the remove function from Gui to remove them. And then you just create the new objects like you created the old ones.

But it is probably better to use panels. So you create a panel for the login screen and a panel for your other screen. In those panels you add the objects you want (just like you added them to the gui). And then you just hide all panels except the login screen. When the login button is clicked, all that you have to do is hide the panel with your login screen and show the other one.

Edit: Here is a small example of what I am trying to say:
Code (cpp) Select
#include <TGUI/TGUI.hpp>

void loadLoginScreen( tgui::Gui& gui )
    tgui::Panel::Ptr loginScreen(gui, "LoginScreen");
    loginScreen->setSize(800, 600);

    // Create the background image
    tgui::Picture::Ptr picture(*loginScreen);
    picture->setSize(800, 600);

    // Create the username label
    tgui::Label::Ptr labelUsername(*loginScreen);
    labelUsername->setPosition(200, 100);

    // Create the password label
    tgui::Label::Ptr labelPassword(*loginScreen);
    labelPassword->setPosition(200, 250);

    // Create the username edit box
    tgui::EditBox::Ptr editBoxUsername(*loginScreen, "Username");
    editBoxUsername->setSize(400, 40);
    editBoxUsername->setPosition(200, 140);

    // Create the password edit box (we will copy the previously created edit box)
    tgui::EditBox::Ptr editBoxPassword = loginScreen->copy(editBoxUsername, "Password");
    editBoxPassword->setPosition(200, 290);

    // Create the login button
    tgui::Button::Ptr button(*loginScreen);
    button->setSize(260, 60);
    button->setPosition(270, 440);

void loadOtherScreen( tgui::Gui& gui )
    tgui::Panel::Ptr otherScreen(gui, "OtherScreen");
    otherScreen->setSize(800, 600);

    // Create the background image
    tgui::Picture::Ptr picture(*otherScreen);
    picture->setSize(800, 600);

int main()
    // Create the window
    sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
    tgui::Gui gui(window);

    // Load the font (you should check the return value to make sure that it is loaded)

    // Load the widgets

    // The login screen is the only panel that should be visible

    // Main loop
    while (window.isOpen())
        sf::Event event;
        while (window.pollEvent(event))
            if (event.type == sf::Event::Closed)

            // Pass the event to all the widgets

        // The callback loop
        tgui::Callback callback;
        while (gui.pollCallback(callback))
            // Make sure tha callback comes from the button
            if ( == 1)
                // Get the login screen
                tgui::Panel::Ptr loginScreen = gui.get("LoginScreen");

                // Get the username and password
                tgui::EditBox::Ptr editBoxUsername = loginScreen->get("Username");
                tgui::EditBox::Ptr editBoxPassword = loginScreen->get("Password");

                sf::String username = editBoxUsername->getText();
                sf::String password = editBoxPassword->getText();

                // Show the other screen


        // Draw all created widgets


    return EXIT_SUCCESS;
You can just use the Picture class instead of Button.
They both inherit from ClickableObject which makes them have the LeftMousePressed, LeftMouseReleased and LeftMouseClicked callbacks.

The numbers behind the "Black.png" is the rectangle to load from the file. If you load the whole image then they can be ommited.
The left part of the normal image of the button starts at (0, 25) in the image and has a width of 50 and a height of 50, hence "(0, 25, 50, 50)".

You shouldn't edit Black.conf. You should make a copy of it and in your code load that copy which you can freely edit.

Edit: There is a small tutorial about the config files.

Edit2: I forgot to answer the question about tooltips. This is not yet possible. I did a poll once about what widget I should add. The first two were MessageBox and MenuBar (which now exist in tgui). ToolTip and PopupMenu came 3th and 4th, but they won't be in v0.6.0. They will probably be the next widgets that will be added but they will have to wait for v0.6.1 or v0.7.
Help requests / Re: Shaking window
09 July 2013, 19:20:40
I just answered on the sfml forum :).
Installation help / Re: gcc errors in linux
09 July 2013, 10:51:55
Ok, thanks for testing.

I'll fix those warnings later today.
EDIT: Done
Installation help / Re: gcc errors in linux
09 July 2013, 00:29:40
Any chance you have nvidea graphics?

If I look for the error then I find this page and this page.
Both aren't exactly the same error (different paths), but they both say that a symbolic link has to be made.
Installation help / Re: gcc errors in linux
09 July 2013, 00:22:08
Never saw that error before. Did you install  graphics drivers?

You should also try installing tgui 0.5 from the ppa as netrick already suggested. I guess it fits the best with the sfml version from the ppa.
Installation help / Re: gcc errors in linux
08 July 2013, 23:47:12
The sfml package from the ppa is the sfml2-RC version which only works with tgui v0.4.

The development version in the ppa contains the real sfml2 and tgui v0.5.

The errors about 'sf::Font' conversion to 'sf::Font*' do mean that the sfml version is not up-to-date and is still the RC version.

And tgui v0.4 is indeed very buggy, it shouldn't be used.
General Discussion / Re: Tgui without Boost
07 July 2013, 20:22:25
Yeah, ubuntu is the reason that I aim at gcc 4.6 instead of 4.7.
If it was up to me I would go for gcc 4.8 which I already have on my arch linux (antergos actually) for some time, but then nobody would use my gui anymore :).

But there is no rush to rewrite it to c++11 as it has no advantages (for the user of my gui) but has the disadvantage of not being supported by older compilers. The only good thing would be that the boost dependency would be removed.
You have a nice day too.
Its hot here in Antwerp as well :).
Ok, so the version that I just pushed to github should compile then.

Thanks for taking the time to investigate what was wrong.
General Discussion / Re: Tgui without Boost
06 July 2013, 15:02:31
Thanks, I'll use this when I start using c++11.
But once I start using c++11 I won't just get rid of boost, I will also use c++11 for the rest of the code, so this is only a small part of what I eventually will write. For tgui v0.6 I also aim to support at least VC++10 and GCC 4.6. So the use of c++11 will still be limited in v0.6.
Did you read the msdn page about the error? Did you try changing optimization?

The error happens on line 2273, but the place that you say it stopped compiling in on a different line. Is this just a mistake or are there errors for other lines than 2273?
EDIT: The line numbers were messed up in my browser for some reason. Now I see that that code is indeed on line 2273.

I don't think I can change the code to solve this, it seems to be a problem with the compiler.
Help requests / Re: Form Builder issues
04 July 2013, 18:54:25
While debugging with VS2010 I only found an assertion when selection the text from any edit box.
So you might want to try and remove the '-1' from the end of line 1711 in EditBox.cpp.

If this doesn't fix your issue then it would indeed be best to debug it yourself. I currently have to borrow a laptop from someone to test on windows and I can't do much either when I can't reproduce it or when I don't have a call stack.
Help requests / Re: Callback help!
04 July 2013, 14:56:51
I didn't look at the code in detail, but you aren't calling window.handleEvent in your event loop which is probably the problem.

In tgui v0.5 the headers aren't installed and you have to either copy the folder yourself like you did or set the path to the include folder in your code blocks settings (or as '-I' parameter to the compiler when using g++ directly).
In tgui v0.6 I have already changed it so that the files are installed correctly when calling "make install".
Help requests / Re: Form Builder issues
04 July 2013, 11:14:07
Strange, I can't reproduce that.

Edit: tested on linux and on windows with GCC/MinGW for both the previous version and the latest version. I doesn't crash here.