-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
(I also posted this issue on the SDL repo here)
When I inspect the keycode associated with a keydown event using event.key.keysym.sym, the value returned is a SDL_Scancode instead of a SDL_Keycode. I would expect event.key.keysym.sym to return a SDL_Keycode according to the SDL documentation. Example:
SDL_Event e;
while (SDL_PollEvent(&e) != 0) {
if (e.type == SDL_KEYDOWN) {
if (e.key.keysym.sym == SDLK_a) {
printf("When I press the A key on my keyboard, this branch does NOT execute\n");
} else if (e.key.keysym.sym == SDL_SCANCODE_A) {
printf("This branch DOES execute when I press the A key on my keyboard.\n");
}
}
}I'm using Emscripten 3.1.54, which uses SDL 2.26.0. I'm compiling the code with the following command:
emcc main.c -o index.html -sUSE_SDL=2
I'm opening the generated page in Chrome Version 121.0.6167.160 on MacOS 11.7.10.
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.54 (a95c44ee924d02fa1498f846595485d27c31daa8)
clang version 19.0.0git (https://github.com/llvm/llvm-project e769fb8699e3fa8e40623764f7713bfc783b0330)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /Users/luis/code/emsdk/upstream/bin
Full link command and output with -v appended:
log.txt
Metadata
Metadata
Assignees
Labels
No labels