#include#include int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Window"); std::cout << "Window size: " << window.getSize().x << " x " << window.getSize().y << std::endl; return 0; }
#includeThis code creates a window like the first example but also has a game loop where it continuously prints the window size while the window is open. The loop also clears the window and displays it every frame to show the window's contents. Package/Library used: SFML#include int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Window"); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } std::cout << "Window size: " << window.getSize().x << " x " << window.getSize().y << std::endl; window.clear(sf::Color::White); window.display(); } return 0; }