diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-02-06 16:37:24 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-02-06 16:37:24 -0800 |
commit | fffcc6cfa23d2eca35679f72985ebfb9007092ac (patch) | |
tree | 4109c903b5c57a45db7eb45ebe8fd8a25d19c4eb | |
parent | 8753da903ae260ef97b5dd23950b7dc33e9935c1 (diff) |
option to not capture keyboard in SDL
-rw-r--r-- | src/library_sdl.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index cfab6410..4ad7a9a9 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -607,9 +607,11 @@ var LibrarySDL = { SDL_Init: function(what) { SDL.startTime = Date.now(); // capture all key events. we just keep down and up, but also capture press to prevent default actions - document.onkeydown = SDL.receiveEvent; - document.onkeyup = SDL.receiveEvent; - document.onkeypress = SDL.receiveEvent; + if (!Module['doNotCaptureKeyboard']) { + document.onkeydown = SDL.receiveEvent; + document.onkeyup = SDL.receiveEvent; + document.onkeypress = SDL.receiveEvent; + } window.onunload = SDL.receiveEvent; SDL.keyboardState = _malloc(0x10000); _memset(SDL.keyboardState, 0, 0x10000); |