1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 13:33:02 +01:00

Replace manual centre calculation with WF_CENTRE_SCREEN flag

This commit is contained in:
Gymnasiast
2025-04-19 14:44:24 +02:00
parent 8b6dda09cf
commit e398feb3b4
2 changed files with 4 additions and 11 deletions

View File

@@ -423,11 +423,8 @@ namespace OpenRCT2::Ui::Windows
gTrackDesignSceneryToggle = false;
_currentTrackPieceDirection = 2;
int32_t screenWidth = ContextGetWidth();
int32_t screenHeight = ContextGetHeight();
auto screenPos = ScreenCoordsXY{ screenWidth / 2 - 201, std::max(kTopToolbarHeight + 1, screenHeight / 2 - 200) };
auto* window = windowMgr->FocusOrCreate<InstallTrackWindow>(WindowClass::InstallTrack, screenPos, WW, WH, 0);
auto* window = windowMgr->FocusOrCreate<InstallTrackWindow>(
WindowClass::InstallTrack, WW, WH, WF_AUTO_POSITION | WF_CENTRE_SCREEN);
window->SetupTrack(path, std::move(trackDesign));
return window;

View File

@@ -189,15 +189,11 @@ namespace OpenRCT2::Ui::Windows
auto* windowMgr = Ui::GetWindowManager();
windowMgr->CloseByClass(WindowClass::TrackDeletePrompt);
int32_t screenWidth = ContextGetWidth();
int32_t screenHeight = ContextGetHeight();
auto trackDeletePromptWindow = std::make_unique<TrackDeletePromptWindow>(tdFileRef);
windowMgr->Create(
std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt,
ScreenCoordsXY(
std::max(kTopToolbarHeight + 1, (screenWidth - WW_DELETE_PROMPT) / 2), (screenHeight - WH_DELETE_PROMPT) / 2),
WW_DELETE_PROMPT, WH_DELETE_PROMPT, WF_STICK_TO_FRONT | WF_TRANSPARENT);
std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt, {}, WW_DELETE_PROMPT, WH_DELETE_PROMPT,
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
}
void TrackDeletePromptWindow::OnOpen()