Main Menu
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

Topics - Toboxos

#1
Help requests / Programm crashes if Window close
02 December 2014, 18:52:41
Hello together,

ive used tgui and i have a little problem. If I close my window the game crashes and i see the follow error message:

This is my code:
#include <SFML\Graphics.hpp>
#include <TGUI\TGUI.hpp>

int main() {
sf::RenderWindow window(sf::VideoMode(800, 600), "TestFenster");
tgui::Gui gui(window);

gui.setGlobalFont("font.ttf");

tgui::Label::Ptr labelUsername(gui);
labelUsername->setText("Username:");
labelUsername->setPosition(200, 100);


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

window.clear(sf::Color(120, 120, 120, 32));
gui.draw();
window.display();
}
}

The programm works perfectly until i close it.

Sorry for my bad english, im from germany