diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 00e88b7ca4..0a507ed367 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -19,6 +19,7 @@ - Fix: [#24829] The pattern of long grass across tiles is different to RCT1 and RCT2. - Fix: [#24831] Park names are being overwritten for custom RCT1 scenarios that use competition id slots. - Fix: [#24838] Not using localized word for conjunction when having multiple shortcuts for the same action. +- Fix: [#24841] Fullscreen options do not work correctly with Emscripten. 0.4.24 (2025-07-05) ------------------------------------------------------------------------ diff --git a/scripts/build-emscripten b/scripts/build-emscripten index a1c54af707..af9065ec36 100755 --- a/scripts/build-emscripten +++ b/scripts/build-emscripten @@ -12,6 +12,7 @@ JSON_DIR=/usr/include/nlohmann/ emcmake cmake ../ \ -G Ninja \ -DDISABLE_NETWORK=ON \ + -DDISABLE_OPENGL=ON \ -DDISABLE_HTTP=ON \ -DDISABLE_TTF=ON \ -DDISABLE_FLAC=ON \ diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 604363a745..5d72e68465 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -182,6 +182,7 @@ public: void SetFullscreenMode(FullscreenMode mode) override { +#ifndef __EMSCRIPTEN__ static constexpr int32_t kSDLFullscreenFlags[] = { 0, SDL_WINDOW_FULLSCREEN, @@ -212,6 +213,16 @@ public: // TODO try another display mode rather than just exiting the game } +#else + if (mode == FullscreenMode::fullscreen) + { + emscripten_request_fullscreen("!canvas", false); + } + else if (mode == FullscreenMode::windowed) + { + emscripten_exit_fullscreen(); + } +#endif // __EMSCRIPTEN__ } const std::vector& GetFullscreenResolutions() override