aboutsummaryrefslogtreecommitdiff
path: root/src/library_sdl.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-04-23 13:02:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-04-23 13:02:52 -0700
commit55c1dfd2c1548ebfd023e4f7d1c2416a11a534f8 (patch)
tree86f9d0ced1ae0bf6b09fe594556e4ac4f63a6e74 /src/library_sdl.js
parent90940429ead09459cc29e8dda86b3d47a7dd20a0 (diff)
parent2c0a4c6ad5c08c03f0c3180346e52326d6f143b9 (diff)
Merge branch 'fix-SDL_GetKeyboardState-not-based-on-scanCode-bug' of github.com:usagi/emscripten into incoming
Conflicts: AUTHORS
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r--src/library_sdl.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js
index eedb8c48..6e235e90 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -686,8 +686,11 @@ var LibrarySDL = {
} else {
code = SDL.keyCodes[event.keyCode] || event.keyCode;
}
+
+ var scan = code & ~(1 << 10);
+ scan = SDL.scanCodes[scan] || scan;
- {{{ makeSetValue('SDL.keyboardState', 'code', 'down', 'i8') }}};
+ {{{ makeSetValue('SDL.keyboardState', 'scan', 'down', 'i8') }}};
// TODO: lmeta, rmeta, numlock, capslock, KMOD_MODE, KMOD_RESERVED
SDL.modState = ({{{ makeGetValue('SDL.keyboardState', '1248', 'i8') }}} ? 0x0040 | 0x0080 : 0) | // KMOD_LCTRL & KMOD_RCTRL
({{{ makeGetValue('SDL.keyboardState', '1249', 'i8') }}} ? 0x0001 | 0x0002 : 0) | // KMOD_LSHIFT & KMOD_RSHIFT