diff --git a/src/Mandelbrot.cpp b/src/Mandelbrot.cpp index 67ebedb..8a9d253 100644 --- a/src/Mandelbrot.cpp +++ b/src/Mandelbrot.cpp @@ -88,15 +88,15 @@ int main() auto window = sf::RenderWindow(sf::VideoMode({ length, length }), "Mandelbrot", sf::Style::Default ^ sf::Style::Resize); window.setFramerateLimit(60); - while (window.isOpen()) { + while (true) { while (const std::optional event = window.pollEvent()) { - if (event->is()) { - window.close(); - } else if (const auto* key_pressed = event->getIf()) { + if (event->is()) + return 0; + + if (const auto* key_pressed = event->getIf()) { switch (key_pressed->scancode) { case sf::Keyboard::Scan::Escape: - window.close(); - break; + return 0; case sf::Keyboard::Scan::Up: origin = { origin.real(), origin.imag() + extent / 25 }; break;