diff --git a/main.cpp b/main.cpp index 73c4dfc..5b9c8d3 100644 --- a/main.cpp +++ b/main.cpp @@ -14,8 +14,7 @@ int main() std::cout << world << std::endl; sf::RenderWindow window(sf::VideoMode(800,600),"Da raycasting"); - world.render(window); - window.display(); + sf::RenderWindow window(sf::VideoMode(1000,1000),"Da raycasting"); sf::Event event{}; sf::Clock frameTime; @@ -23,9 +22,19 @@ int main() { while (window.pollEvent(event)) { - if (event.type == sf::Event::Closed) - window.close(); - else if (event.type == sf::Event::KeyPressed) { + if (event.type == sf::Event::Closed) { + window.close(); + continue; + } + if (event.type == sf::Event::Resized) { + // Keep the view area fit to the window. + sf::FloatRect newView(0, 0, + static_cast(event.size.width), + static_cast(event.size.height)); + window.setView(sf::View(newView)); + continue; + } + if (event.type == sf::Event::KeyPressed) { switch (event.key.code) { case sf::Keyboard::Key::Escape: window.close();