fix Ctrl-C not stopping in console mode
This commit is contained in:
parent
d882fd33f8
commit
4d1b69e905
10
src/main.cpp
10
src/main.cpp
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "SDL_events.h"
|
||||||
#include "ta-log.h"
|
#include "ta-log.h"
|
||||||
#include "fileutils.h"
|
#include "fileutils.h"
|
||||||
#include "engine/engine.h"
|
#include "engine/engine.h"
|
||||||
|
|
@ -357,13 +358,12 @@ int main(int argc, char** argv) {
|
||||||
if (consoleMode) {
|
if (consoleMode) {
|
||||||
logI("playing...\n");
|
logI("playing...\n");
|
||||||
e.play();
|
e.play();
|
||||||
|
SDL_Event ev;
|
||||||
while (true) {
|
while (true) {
|
||||||
#ifdef _WIN32
|
SDL_WaitEvent(&ev);
|
||||||
Sleep(500);
|
if (ev.type==SDL_QUIT) break;
|
||||||
#else
|
|
||||||
usleep(500000);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
e.quit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue