diff --git a/examples/demo/01-snake/snake.c b/examples/demo/01-snake/snake.c index 91ffdc789f..0d00a33816 100644 --- a/examples/demo/01-snake/snake.c +++ b/examples/demo/01-snake/snake.c @@ -214,10 +214,12 @@ void snake_step(SnakeContext *ctx) static SDL_AppResult handle_key_event_(SnakeContext *ctx, SDL_Keycode key_code) { switch (key_code) { +#ifndef SDL_PLATFORM_EMSCRIPTEN /* Quit. */ case SDLK_ESCAPE: case SDLK_Q: return SDL_APP_SUCCESS; +#endif /* Restart the game as if the program was launched. */ case SDLK_R: snake_initialize(ctx); diff --git a/examples/demo/02-woodeneye-008/woodeneye-008.c b/examples/demo/02-woodeneye-008/woodeneye-008.c index a256767c7a..6e85945339 100644 --- a/examples/demo/02-woodeneye-008/woodeneye-008.c +++ b/examples/demo/02-woodeneye-008/woodeneye-008.c @@ -434,7 +434,9 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) case SDL_EVENT_KEY_UP: { SDL_Scancode scancode = event->key.scancode; SDL_KeyboardID id = event->key.which; +#ifndef SDL_PLATFORM_EMSCRIPTEN if (scancode == SDL_SCANCODE_ESCAPE) return SDL_APP_SUCCESS; +#endif int index = whoseKeyboard(id, players, player_count); if (index >= 0) { if (scancode == SDL_SCANCODE_W) players[index].wasd &= 30; diff --git a/examples/demo/04-bytepusher/bytepusher.c b/examples/demo/04-bytepusher/bytepusher.c index 25525735bf..e1661b5018 100644 --- a/examples/demo/04-bytepusher/bytepusher.c +++ b/examples/demo/04-bytepusher/bytepusher.c @@ -346,7 +346,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) { break; case SDL_EVENT_KEY_DOWN: -#ifndef __EMSCRIPTEN__ +#ifndef SDL_PLATFORM_EMSCRIPTEN if (event->key.key == SDLK_ESCAPE) { return SDL_APP_SUCCESS; }