Skip to content

Commit 2b0cac3

Browse files
committed
fix events polling
1 parent 9a9ca13 commit 2b0cac3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sources/src/main.d

+7-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ int boot()
115115
writefln("press c button - full screen");
116116
for(int i1 = 0; i1 < 60; i1++){
117117
SDL_Delay(16);
118-
SDL_PollEvent(&event);
118+
while (SDL_PollEvent(&event)){}
119119
getPAD();
120120
}
121121
}
@@ -150,9 +150,13 @@ int boot()
150150
setTSK(GROUP_00,&TSKgctrl);
151151

152152
while(game_exec){
153-
SDL_PollEvent(&event);
153+
while (game_exec && SDL_PollEvent(&event)){
154+
if(event.type == SDL_QUIT){
155+
game_exec = 0;
156+
}
157+
}
154158
getPAD();
155-
if((game_exec == 1 && (trgs & PAD_BUTTON9)) || event.type == SDL_QUIT){
159+
if(game_exec == 1 && (trgs & PAD_BUTTON9)){
156160
game_exec = 0;
157161
}
158162
if(!pause && game_exec == 2 && (trgs & PAD_BUTTON9)){

0 commit comments

Comments
 (0)