Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #include <TGUI/TGUI.hpp>
- int main()
- {
- // Create the main window
- sf::RenderWindow app(sf::VideoMode(800, 600), "SFML window");
- tgui::Gui gui;
- gui.setTarget(app);
- auto child = tgui::ChildWindow::create();
- child->connect("closed", [&](tgui::ChildWindow::Ptr window) {
- });
- gui.add(child); // Closing the window make the program crash.
- // Start the game loop
- while (app.isOpen())
- {
- // Process events
- sf::Event event;
- while (app.pollEvent(event))
- {
- gui.handleEvent(event);
- // Close window : exit
- if (event.type == sf::Event::Closed)
- app.close();
- }
- // Clear screen
- app.clear();
- // Draw the GUI
- gui.draw();
- // Update the window
- app.display();
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement