From 8f516db42bf3f4a084b0431849bf1d55af49a7b0 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Tue, 23 Jan 2018 15:04:11 -0600 Subject: [PATCH] Remove arbitrary counter and allow escape to exit --- src/vm_screen.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/vm_screen.c b/src/vm_screen.c index 486c385..131df91 100644 --- a/src/vm_screen.c +++ b/src/vm_screen.c @@ -169,7 +169,6 @@ vm_screen_active(vm_screen *screen) { SDL_Event event; char ch; - static int counter = 300000; // There may be _many_ events in the queue; for example, you may be // facerolling on Zork because it feels good. And good for you if @@ -202,16 +201,16 @@ vm_screen_active(vm_screen *screen) case SDL_KEYUP: // Note we do not erase the last_key value. screen->key_pressed = false; + + if (ch == SDLK_ESCAPE) { + return false; + } + break; } } - if (counter--) { - return true; - } - - SDL_Delay(2000); - return false; + return true; } /*