Tetris: use new event retreival function

This commit is contained in:
zv0n 2020-10-20 11:43:36 +02:00
parent 2b2f5aa940
commit ca4ccbebc8

View File

@ -389,8 +389,7 @@ void handleKeyUpMain( SDL_Keycode key ) {
void pollEventsMain( SDLPP::Scene &scene ) { void pollEventsMain( SDLPP::Scene &scene ) {
SDL_Event event; SDL_Event event;
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) { while ( SDLPP::getSDLEvent( event ) ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) { switch ( event.type ) {
case SDL_QUIT: case SDL_QUIT:
quitGame(); quitGame();
@ -502,8 +501,7 @@ void handleKeyDownMenu( SDL_Keycode key ) {
void pollEventsMenu() { void pollEventsMenu() {
SDL_Event event; SDL_Event event;
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) { while ( SDLPP::getSDLEvent( event ) ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) { switch ( event.type ) {
case SDL_QUIT: case SDL_QUIT:
quitGame(); quitGame();
@ -568,8 +566,7 @@ void handleKeyDownGameOver( SDL_Keycode key ) {
void pollEventsGameOver() { void pollEventsGameOver() {
SDL_Event event; SDL_Event event;
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) { while ( SDLPP::getSDLEvent( event ) ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) { switch ( event.type ) {
case SDL_QUIT: case SDL_QUIT:
quitGame(); quitGame();
@ -692,8 +689,7 @@ void handleKeyDownOptions( SDL_Keycode key ) {
void pollEventsOptions() { void pollEventsOptions() {
SDL_Event event; SDL_Event event;
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) { while ( SDLPP::getSDLEvent( event ) ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) { switch ( event.type ) {
case SDL_QUIT: case SDL_QUIT:
quitGame(); quitGame();