- key = sdlkey_to_gamekey(ev->key.keysym.sym, ev->key.keysym.mod);
- key_event(key, ev->key.state == SDL_PRESSED ? 1 : 0);
+ if(key_event) {
+ key = sdlkey_to_gamekey(ev->key.keysym.sym, ev->key.keysym.mod);
+ key_event(key, ev->key.state == SDL_PRESSED ? 1 : 0);
+ } else {
+ if(ev->key.keysym.sym == SDLK_ESCAPE) {
+ quit = 1;
+ }
+ }