diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-28 21:29:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-28 21:29:02 -0800 |
commit | 687b8cfa3d105a634b3c9cfbc5fc287f1517fae3 (patch) | |
tree | eea2952d7673296ba6a8cd2384061fc3ad270473 /src/library_sdl.js | |
parent | c516fa7758636e15a7077c658db3c74533c7ee38 (diff) | |
parent | b6ebeed2cfcebb220f2ce700c7cbe484e62cd2e2 (diff) |
Merge branch 'master' into llvmopts
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r-- | src/library_sdl.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index ce26a106..d438fc23 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -176,6 +176,11 @@ mergeInto(LibraryManager.library, { try { var ctx = Module.canvas.getContext(useWebGL ? 'experimental-webgl' : '2d'); if (!ctx) throw 'Could not create canvas :('; + if (useWebGL) { + // Set the background of the WebGL canvas to black, because SDL gives us a + // window which has a black background by default. + Module.canvas.style.backgroundColor = "black"; + } return Module.ctx = ctx; } catch (e) { Module.print('(canvas not available)'); @@ -555,5 +560,15 @@ mergeInto(LibraryManager.library, { // SDL Mixer Mix_OpenAudio: function() { return -1 }, + + SDL_AddTimer: function(interval, callback, param) { + return window.setTimeout(function() { + FUNCTION_TABLE[callback](interval, param); + }, interval); + }, + SDL_RemoveTimer: function(id) { + window.clearTimeout(id); + return true; + }, }); |