aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-10-23 17:43:01 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-10-23 17:43:50 +0300
commit72d25f1d46f25a6aa4fbaea884bb583cec7332c5 (patch)
tree40376c6e5355ea64bb0353a45252198a4fd3b8c4 /src
parent785f61c1795649de42561dd60cb4e81c06cccb04 (diff)
Implement SDL_SetVideoMode(0,0, ...) to create the canvas in whatever size the <canvas> was in, and not try to resize the canvas to 0x0 pixels. Derive a new test for that from sdl_ogl.c. Fixes #1059.
Diffstat (limited to 'src')
-rw-r--r--src/library_sdl.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js
index a0689343..857ab7d4 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -786,6 +786,14 @@ var LibrarySDL = {
['mousedown', 'mouseup', 'mousemove', 'DOMMouseScroll', 'mousewheel', 'mouseout'].forEach(function(event) {
Module['canvas'].addEventListener(event, SDL.receiveEvent, true);
});
+
+ // (0,0) means 'use fullscreen' in native; in Emscripten, use the current canvas size.
+ if (width == 0 && height == 0) {
+ var canvas = Module['canvas'];
+ width = canvas.width;
+ height = canvas.height;
+ }
+
Browser.setCanvasSize(width, height, true);
// Free the old surface first.
if (SDL.screen) {