diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-04-23 13:02:52 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-04-23 13:02:52 -0700 |
commit | 55c1dfd2c1548ebfd023e4f7d1c2416a11a534f8 (patch) | |
tree | 86f9d0ced1ae0bf6b09fe594556e4ac4f63a6e74 | |
parent | 90940429ead09459cc29e8dda86b3d47a7dd20a0 (diff) | |
parent | 2c0a4c6ad5c08c03f0c3180346e52326d6f143b9 (diff) |
Merge branch 'fix-SDL_GetKeyboardState-not-based-on-scanCode-bug' of github.com:usagi/emscripten into incoming
Conflicts:
AUTHORS
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | src/library_sdl.js | 5 |
2 files changed, 5 insertions, 2 deletions
@@ -136,5 +136,5 @@ a license to everyone to use it as detailed in LICENSE.) * Thomas Borsos <thomasborsos@gmail.com> * Ori Avtalion <ori@avtalion.name> * Guillaume Blanc <guillaumeblanc.sc@gmail.com> - +* Usagi Ito <usagi@WonderRabbitProject.net> 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 |