#include#include int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Window"); // get the size of the window sf::Vector2u windowSize = window.getSize(); std::cout << "Window size: " << windowSize.x << " x " << windowSize.y << std::endl; return 0; }
#includeIn this example, we create a render window with a size of 800x600 pixels and a title "SFML Window". We then use the setSize function to change the size of the window to 1024x768 pixels. Note that we need to include this function in the game loop in order to see the change in size.int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Window"); // change the size of the window window.setSize(sf::Vector2u(1024, 768)); while (window.isOpen()) { // game loop } return 0; }