From 4cef38456a70f364410da5960ff2d64609c039bc Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Tue, 23 Jul 2024 19:21:06 +0200 Subject: [PATCH] Keep progress bar window centred after resize (#22354) --- distribution/changelog.txt | 1 + src/openrct2/interface/Window.cpp | 8 ++++++++ src/openrct2/scenes/preloader/PreloaderScene.cpp | 10 +++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 95a64827ecf5..7792ed537b6c 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -19,6 +19,7 @@ - Fix: [#22304] Graphs don't draw lines on the left edge of the screen. - Fix: [#22318] Water sparkles are missing if transparent water is enabled without RCT1 linked. - Fix: [#22333] Tile inspector closes other tool windows. +- Fix: [#22348] Progress bar screen doesn't handle window resizing. 0.4.12 (2024-07-07) ------------------------------------------------------------------------ diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index a942583e0153..aa1c7e7ce174 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -1427,6 +1427,14 @@ void WindowResizeGui(int32_t width, int32_t height) optionsWindow->windowPos.y = (ContextGetHeight() - optionsWindow->height) / 2; } + // Keep progress bar window centred after a resize + WindowBase* ProgressWindow = WindowFindByClass(WindowClass::ProgressWindow); + if (ProgressWindow != nullptr) + { + ProgressWindow->windowPos.x = (ContextGetWidth() - ProgressWindow->width) / 2; + ProgressWindow->windowPos.y = (ContextGetHeight() - ProgressWindow->height) / 2; + } + GfxInvalidateScreen(); } diff --git a/src/openrct2/scenes/preloader/PreloaderScene.cpp b/src/openrct2/scenes/preloader/PreloaderScene.cpp index 1dd085e9d159..7ab77c98da4d 100644 --- a/src/openrct2/scenes/preloader/PreloaderScene.cpp +++ b/src/openrct2/scenes/preloader/PreloaderScene.cpp @@ -44,11 +44,6 @@ void PreloaderScene::Load() WindowSetFlagForAllViewports(VIEWPORT_FLAG_RENDERING_INHIBITED, true); WindowResizeGui(ContextGetWidth(), ContextGetHeight()); - // Reset screen - auto* engine = GetContext().GetDrawingEngine(); - auto* drawingContext = engine->GetDrawingContext(); - drawingContext->Clear(*engine->GetDrawingPixelInfo(), PALETTE_INDEX_10); - LOG_VERBOSE("PreloaderScene::Load() finished"); } @@ -59,6 +54,11 @@ void PreloaderScene::Tick() ContextHandleInput(); WindowInvalidateAll(); + // Reset screen + auto* engine = GetContext().GetDrawingEngine(); + auto* drawingContext = engine->GetDrawingContext(); + drawingContext->Clear(*engine->GetDrawingPixelInfo(), PALETTE_INDEX_10); + gInUpdateCode = false; if (_jobs.CountPending() == 0 && _jobs.CountProcessing() == 0)