Renderwindow Exceptions

Started by tmm, 14 March 2014, 14:15:26

tmm

Hi,

first of all thank you for providing TGUI. It looks awesome ;)

Now to my problem. I just made a little game with sfml and Visual Studio 2012.
I just downloaded your precompiled libs.
And got it working fine, untill I close the RenderWindow.
Something like Heap damaged.

So I just started to play around with shared_ptr and and and.. nothing worked..

Then I got other errors from just calling the window.clear() or draw some other stuff.
And I made a new Project to just test TGUI.

But now I can't even get the tutorial programm running :( It seems like some window methods do cause exceptions. Please help me:

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

   /*
if (gui.setGlobalFont("arial.ttf")  == false){
      std::cout << "Main(): Can't find font!\n";
      throw new std::exception("Client_Root: Can't find font!");
   }
   */
    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;
}

throwing exceptions on:

window.clear()
window.close()
window.display()


Hope it's not a very embarrasing mistake of mine  :P :-[


texus

A few things to check:
Are you sure you are using the SFML libraries that are included with the TGUI download?
Are you sure that you are linking to the correct libraries (debug libs in debug mode, release libs in release mode)?
Are you sure you downloaded the VS2012 version?

tmm

#2
Yes I checked, everything again.

Debug: tgui-d.lib; sfml-audio-d.lib;sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-network-d.lib;....
Release: tgui.lib;sfml-audio.lib;sfml-graphics.lib;sfml-window.lib;sfml-system.lib;sfml-network.lib;....

I replaced all dlls and lib with the ones from the download.

Downloaded zip says TGUI-0.6.1 C++11 (2012)

So I guess everything correct.


Edit: If i comment window.clear() and window.display() out, it works untill i close the window...

texus

#3
I was afraid you were going to answer that.

Could you send me your visual studio project so that I can test it here? (upload it or dropbox or some similar place)

tmm

Will sent u a private message to my GDrive ;)