*

Superdude

  • *
  • 7
  • A newbie who is almost not a newbie.
    • View Profile
Main Window crashes and stuff
« on: 29 August 2013, 21:09:52 »
Here is my code:

Code: [Select]
#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.
First they ignore you, then they laugh at you, then they fight you, then you win. - Mohandas Gandhi

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Main Window crashes and stuff
« Reply #1 on: 29 August 2013, 21:35:51 »
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

  • *
  • 7
  • A newbie who is almost not a newbie.
    • View Profile
Re: Main Window crashes and stuff
« Reply #2 on: 29 August 2013, 23:44:22 »
VC++ 2012

I am pretty sure that that is not the problem.
First they ignore you, then they laugh at you, then they fight you, then you win. - Mohandas Gandhi

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Main Window crashes and stuff
« Reply #3 on: 30 August 2013, 00:23:23 »
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

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Main Window crashes and stuff
« Reply #4 on: 02 September 2013, 20:54:59 »
The libraries were rebuild and tested, so if you have the same problem with the new alpha2 libraries then let me know.