From 23e7e8747c44d17d9eb76422007301839038dd91 Mon Sep 17 00:00:00 2001 From: Aakarshan Raj <32811006+aakarshan-raj@users.noreply.github.com> Date: Wed, 16 Nov 2022 19:24:23 +0530 Subject: [PATCH] Fixed unwanted dialog popping during execution a dialog box pops up while program is running in my machine which is ubuntu, It says program not responding, Its mainly cause we are not handling the events, i fixed it. --- DiveIntoC++11/1_Arkanoid/p9.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/DiveIntoC++11/1_Arkanoid/p9.cpp b/DiveIntoC++11/1_Arkanoid/p9.cpp index 4469c65..8ae3d14 100644 --- a/DiveIntoC++11/1_Arkanoid/p9.cpp +++ b/DiveIntoC++11/1_Arkanoid/p9.cpp @@ -153,13 +153,15 @@ int main() RenderWindow window{{windowWidth, windowHeight}, "Arkanoid - 9"}; window.setFramerateLimit(60); - + + Event event; while(true) { window.clear(Color::Black); - if(Keyboard::isKeyPressed(Keyboard::Key::Escape)) break; - + while(window.pollEvent(event)){ + if(Keyboard::isKeyPressed(Keyboard::Key::Escape)) window.close(); + } ball.update(); paddle.update(); testCollision(paddle, ball); @@ -178,4 +180,4 @@ int main() } return 0; -} \ No newline at end of file +}