aboutsummaryrefslogtreecommitdiff
path: root/src/library_sdl.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r--src/library_sdl.js15
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;
+ },
});