diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-08 09:34:51 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-08 09:34:51 -0700 |
commit | 0a1110333ae81557e6319f2109bc591f834dbc16 (patch) | |
tree | e9aec0920e55d529b5b1133c1f37b3fe384c1ece /tests/sdl_key.c | |
parent | c78357cce927d3ffc80fcafabc3cd20cf2751d38 (diff) |
support for sdl scancodes
Diffstat (limited to 'tests/sdl_key.c')
-rw-r--r-- | tests/sdl_key.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/sdl_key.c b/tests/sdl_key.c index 633e975f..6a5ad694 100644 --- a/tests/sdl_key.c +++ b/tests/sdl_key.c @@ -19,7 +19,13 @@ void one() { case SDLK_UP: printf("up\n"); result *= 7; break; case SDLK_SPACE: printf("space\n"); result *= 11; break; case SDLK_a: printf("a\n"); result *= 13; break; - default: { REPORT_RESULT(); emscripten_run_script("throw 'done'"); } + default: { + if (event.key.keysym.scancode == SDL_SCANCODE_B) { + printf("b scancode\n"); result *= 17; break; + } + REPORT_RESULT(); + emscripten_run_script("throw 'done'"); + } } break; default: /* Report an unhandled event */ @@ -38,6 +44,7 @@ int main(int argc, char **argv) { emscripten_run_script("simulateKeyEvent(39)"); emscripten_run_script("simulateKeyEvent(32)"); emscripten_run_script("simulateKeyEvent(97)"); + emscripten_run_script("simulateKeyEvent(98)"); emscripten_run_script("simulateKeyEvent(100)"); // trigger the end if (argc == 1337) one(); // keep it alive |