diff options
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r-- | src/library_sdl.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index a0689343..e652dfc8 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -254,9 +254,13 @@ var LibrarySDL = { } var webGLContextAttributes = { - antialias: ((SDL.glAttributes[13 /*SDL_GL_MULTISAMPLEBUFFERS*/] != 0) && (SDL.glAttributes[14 /*SDL_GL_MULTISAMPLESAMPLES*/] > 1)) + antialias: ((SDL.glAttributes[13 /*SDL_GL_MULTISAMPLEBUFFERS*/] != 0) && (SDL.glAttributes[14 /*SDL_GL_MULTISAMPLESAMPLES*/] > 1)), + depth: (SDL.glAttributes[6 /*SDL_GL_DEPTH_SIZE*/] > 0), + stencil: (SDL.glAttributes[7 /*SDL_GL_STENCIL_SIZE*/] > 0) }; + var ctx = Browser.createContext(canvas, useWebGL, usePageCanvas, webGLContextAttributes); + SDL.surfaces[surf] = { width: width, height: height, @@ -786,6 +790,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) { |