Merge pull request #16019 from eska014/html5-fix-no-resize-on-start

Fix HTML5 JS API setResizeCanvasOnStart
This commit is contained in:
Rémi Verschelde 2018-01-24 08:30:43 +01:00 committed by GitHub
commit 5ff8d4b07d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -430,16 +430,11 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
// can't fulfil fullscreen request due to browser security // can't fulfil fullscreen request due to browser security
video_mode.fullscreen = false; video_mode.fullscreen = false;
/* clang-format off */ /* clang-format off */
bool resize_canvas_on_start = EM_ASM_INT_V( if (EM_ASM_INT_V({ return Module.resizeCanvasOnStart })) {
return Module.resizeCanvasOnStart; /* clang-format on */
);
/* clang-format on */
if (resize_canvas_on_start) {
set_window_size(Size2(video_mode.width, video_mode.height)); set_window_size(Size2(video_mode.width, video_mode.height));
} else { } else {
Size2 canvas_size = get_window_size(); set_window_size(get_window_size());
video_mode.width = canvas_size.width;
video_mode.height = canvas_size.height;
} }
char locale_ptr[16]; char locale_ptr[16];