diff options
author | Aleksander Guryanov <caiiiycuk@gmail.com> | 2012-07-18 21:35:46 +0700 |
---|---|---|
committer | Aleksander Guryanov <caiiiycuk@gmail.com> | 2012-07-19 22:42:47 +0700 |
commit | 73a5d618d53737c9f6854cabb599e37d44d01dfc (patch) | |
tree | 435d5287815b93284d69fa97e1a70dbac2c5cbfa /src/library_sdl.js | |
parent | 83593bc18d53d66fb8407efb60ab3c1444d99005 (diff) |
Fix sdl_getmod
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r-- | src/library_sdl.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 662620d6..95dc4c4e 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -430,9 +430,13 @@ var LibrarySDL = { {{{ makeSetValue('SDL.keyboardState', 'SDL.keyCodes[event.keyCode] || event.keyCode', 'event.type == "keydown"', 'i8') }}}; - SDL.shiftKey = event.shiftKey; - SDL.ctrlKey = event.ctrlKey; - SDL.altKey = event.altKey; + if (event.keyCode == 16) { //shift + SDL.shiftKey = event.type == "keydown"; + } else if (event.keyCode == 17) { //control + SDL.ctrlKey = event.type == "keydown"; + } else if (event.keyCode == 18) { //alt + SDL.altKey = event.type == "keydown"; + } break; } @@ -798,9 +802,9 @@ var LibrarySDL = { SDL_GetModState: function() { // TODO: numlock, capslock, etc. - return (SDL.shiftKey ? 0x0001 & 0x0002 : 0) | // KMOD_LSHIFT & KMOD_RSHIFT - (SDL.ctrlKey ? 0x0040 & 0x0080 : 0) | // KMOD_LCTRL & KMOD_RCTRL - (SDL.altKey ? 0x0100 & 0x0200 : 0); // KMOD_LALT & KMOD_RALT + return (SDL.shiftKey ? 0x0001 | 0x0002 : 0) | // KMOD_LSHIFT & KMOD_RSHIFT + (SDL.ctrlKey ? 0x0040 | 0x0080 : 0) | // KMOD_LCTRL & KMOD_RCTRL + (SDL.altKey ? 0x0100 | 0x0200 : 0); // KMOD_LALT & KMOD_RALT }, SDL_GetMouseState: function(x, y) { |