Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make apps quit on ctrl-c in console

  • Loading branch information...
commit 32523b525b68bd6eefb1ff48ed1b42fbe42bce6c 1 parent 79424c8
@sebseb7 authored
Showing with 23 additions and 15 deletions.
  1. +23 −15 firmware/sim/main.c
View
38 firmware/sim/main.c
@@ -87,21 +87,29 @@ int main(int argc, char *argv[]) {
while(running) {
SDL_Event ev;
while(SDL_PollEvent(&ev)) {
- switch(ev.key.keysym.sym) {
- case SDLK_ESCAPE:
- running = 0;
- break;
-
- case 'd':
- case SDLK_RIGHT:
- key_emit(KEY_A, ev.type);
- break;
-
- case 'a':
- case SDLK_LEFT:
- key_emit(KEY_B, ev.type);
- break;
-
+ switch(ev.type) {
+ case SDL_QUIT:
+ running = 0;
+ break;
+ case SDL_KEYUP:
+ case SDL_KEYDOWN:
+ switch(ev.key.keysym.sym) {
+ case SDLK_ESCAPE:
+ running = 0;
+ break;
+
+ case 'd':
+ case SDLK_RIGHT:
+ key_emit(KEY_A, ev.type);
+ break;
+
+ case 'a':
+ case SDLK_LEFT:
+ key_emit(KEY_B, ev.type);
+ break;
+
+ default: break;
+ }
default: break;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.