From 4d1b69e905e927647827710d44f28763044e4155 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 26 Jan 2022 03:00:58 -0500 Subject: [PATCH] fix Ctrl-C not stopping in console mode --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a127d6882..1143d8c84 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "SDL_events.h" #include "ta-log.h" #include "fileutils.h" #include "engine/engine.h" @@ -357,13 +358,12 @@ int main(int argc, char** argv) { if (consoleMode) { logI("playing...\n"); e.play(); + SDL_Event ev; while (true) { -#ifdef _WIN32 - Sleep(500); -#else - usleep(500000); -#endif + SDL_WaitEvent(&ev); + if (ev.type==SDL_QUIT) break; } + e.quit(); return 0; }