See JSEvents_resizeCanvasForFullscreen, where strategy is supplied.
Our resize options resizeCanvasOnFullscreenChange and adjustViewportByDevicePixelRatio are appropriate when using the default strategy (via emscripten_request_fullscreen()). However, this differs when specifying the strategy by emscripten_request_fullscreen_strategy() and emscripten_request_softfullscreen():
EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE does not apply any canvas sizing behavior. This is default.
EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF is equivalent to { resizeCanvasOnFullscreenChange: true, adjustViewportByDevicePixelRatio: false}
EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF is equivalent to { resizeCanvasOnFullscreenChange: true, adjustViewportByDevicePixelRatio: true}
Resolution
Notes
- How well does soft-fullscreen work in React, etc.?
- If I want to implement scaled canvas sizing (render at half resolution, etc.), I have to do so on JS-side; emscripten does not provide functions for this
See
JSEvents_resizeCanvasForFullscreen, wherestrategyis supplied.Our resize options
resizeCanvasOnFullscreenChangeandadjustViewportByDevicePixelRatioare appropriate when using the default strategy (viaemscripten_request_fullscreen()). However, this differs when specifying the strategy byemscripten_request_fullscreen_strategy()andemscripten_request_softfullscreen():EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONEdoes not apply any canvas sizing behavior. This is default.EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEFis equivalent to{ resizeCanvasOnFullscreenChange: true, adjustViewportByDevicePixelRatio: false}EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEFis equivalent to{ resizeCanvasOnFullscreenChange: true, adjustViewportByDevicePixelRatio: true}Resolution
resizeCanvasOnFullscreenChangeandadjustViewportByDevicePixelRatiointo private variablesJSEvents.resizeCanvasForFullscreento set these both variables to true ifEMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE, otherwise set both variables to falseresizeCanvasOnElementSizingis falsefixCanvasViewportis still necessary for non-fullscreen operations. In the canvas resize handler, attach this call toresizeCanvasOnElementSizinginstead ofadjustViewportByDevicePixelRatio.EMSCRIPTEN_FULLSCREEN_FILTERING_NEAREST/BILINEAR(CSS is only changed from default forNEAREST--image-rendering: optimize-speed;Notes