#includeint main() { sf::RenderWindow window(sf::VideoMode(800, 600), "My Window"); window.close(); //closes the window return 0; }
#includeIn this example, we create a window with SFML and then wait for the user to click the close button. When the user clicks this button, we close the window using the close() method.int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "My Window"); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); //closes the window when user clicks the close button } } return 0; }