Main Window crashes and stuff

Started by Superdude, 29 August 2013, 21:09:52

Superdude

Here is my code:


#include <TGUI/TGUI.hpp>

int main()
{
    // Create the window
    sf::RenderWindow window(sf::VideoMode(1024,576), "Window");
    tgui::Gui gui(window);
gui.loadWidgetsFromFile("form.txt");

    // Load the font (you should check the return value to make sure that it is loaded)
    gui.setGlobalFont("fonts/DejaVuSans.ttf");
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            // Pass the event to all the widgets (if there would be widgets)
            gui.handleEvent(event);
        }

        window.clear();

        // Draw all created widgets
        gui.draw();

        window.display();
    }

    return EXIT_SUCCESS;
}



Pretty much a copy of the tutorial, with some modifications.

So, I build and the console and window comes up(completely white). Pauses for  a few seconds, and stops working.

I have a form.txt and images folder from the form builder app. So I do not know what is wrong.

texus

Could you also include the form.txt file so that I can make sure that the form builder didn't mess something up?

What compiler are u using? (VC++ I guess)
Did you download the precompiled library? (You might want to try to build the library yourself to be sure)

Most likely problem for a crash in Visual Studio is linking debug libraries in release mode (or release libs in debug mode), so make sure this isn't the case.

PS: If the crash is fixed and you want your text in the widgets to show up then you should place the setGlobalFont before your loadWidgetsFromFile function call.

Superdude

VC++ 2012

I am pretty sure that that is not the problem.

texus

Everything seems fine.
It works on linux but I can't test on windows right now.

What you should do is try to rebuild the library because I can not vouch for the stability of the precompiled libraries at this moment.

texus

The libraries were rebuild and tested, so if you have the same problem with the new alpha2 libraries then let me know.