forked from rosebudai/OpenRCT2-Web
Pass ScreenSize to window creation functions
This commit is contained in:
78 files changed
+154
-151
No files matched your search
@@ -658,7 +658,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, const ScreenSize windowSize)
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
@@ -667,11 +667,11 @@ public:
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
if (loc.x + width <= w->windowPos.x)
|
||||
if (loc.x + windowSize.width <= w->windowPos.x)
|
||||
continue;
|
||||
if (loc.x >= w->windowPos.x + w->width)
|
||||
continue;
|
||||
if (loc.y + height <= w->windowPos.y)
|
||||
if (loc.y + windowSize.height <= w->windowPos.y)
|
||||
continue;
|
||||
if (loc.y >= w->windowPos.y + w->height)
|
||||
continue;
|
||||
@@ -681,26 +681,26 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, ScreenSize windowSize)
|
||||
{
|
||||
if (loc.x < 0)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && gLegacyScene != LegacyScene::titleSequence)
|
||||
return false;
|
||||
if (loc.x + width > ContextGetWidth())
|
||||
if (loc.x + windowSize.width > ContextGetWidth())
|
||||
return false;
|
||||
if (loc.y + height > ContextGetHeight())
|
||||
if (loc.y + windowSize.height > ContextGetHeight())
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
return WindowFitsBetweenOthers(loc, windowSize);
|
||||
}
|
||||
|
||||
static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, const ScreenSize windowSize)
|
||||
{
|
||||
uint16_t screenWidth = ContextGetWidth();
|
||||
uint16_t screenHeight = ContextGetHeight();
|
||||
int32_t unk;
|
||||
|
||||
unk = -(width / 4);
|
||||
unk = -(windowSize.width / 4);
|
||||
if (loc.x < unk)
|
||||
return false;
|
||||
unk = screenWidth + (unk * 2);
|
||||
@@ -708,50 +708,48 @@ public:
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && gLegacyScene != LegacyScene::titleSequence)
|
||||
return false;
|
||||
unk = screenHeight - (height / 4);
|
||||
unk = screenHeight - (windowSize.height / 4);
|
||||
if (loc.y > unk)
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
return WindowFitsBetweenOthers(loc, windowSize);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY ClampWindowToScreen(
|
||||
const ScreenCoordsXY& pos, const int32_t screenWidth, const int32_t screenHeight, const int32_t width,
|
||||
const int32_t height)
|
||||
const ScreenCoordsXY& pos, const ScreenSize screenSize, const ScreenSize windowSize)
|
||||
{
|
||||
auto screenPos = pos;
|
||||
if (width > screenWidth || screenPos.x < 0)
|
||||
if (windowSize.width > screenSize.width || screenPos.x < 0)
|
||||
screenPos.x = 0;
|
||||
else if (screenPos.x + width > screenWidth)
|
||||
screenPos.x = screenWidth - width;
|
||||
else if (screenPos.x + windowSize.width > screenSize.width)
|
||||
screenPos.x = screenSize.width - windowSize.width;
|
||||
|
||||
auto toolbarAllowance = gLegacyScene == LegacyScene::titleSequence ? 0 : (kTopToolbarHeight + 1);
|
||||
if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance)
|
||||
if (windowSize.height - toolbarAllowance > screenSize.height || screenPos.y < toolbarAllowance)
|
||||
screenPos.y = toolbarAllowance;
|
||||
else if (screenPos.y + height - toolbarAllowance > screenHeight)
|
||||
screenPos.y = screenHeight + toolbarAllowance - height;
|
||||
else if (screenPos.y + windowSize.height - toolbarAllowance > screenSize.height)
|
||||
screenPos.y = screenSize.height + toolbarAllowance - windowSize.height;
|
||||
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetAutoPositionForNewWindow(int32_t width, int32_t height)
|
||||
static ScreenCoordsXY GetAutoPositionForNewWindow(const ScreenSize windowSize)
|
||||
{
|
||||
auto& uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext.GetWidth();
|
||||
auto screenHeight = uiContext.GetHeight();
|
||||
ScreenSize screenSize = { uiContext.GetWidth(), uiContext.GetHeight() };
|
||||
|
||||
// Place window in an empty corner of the screen
|
||||
const ScreenCoordsXY cornerPositions[] = {
|
||||
{ 0, 30 }, // topLeft
|
||||
{ screenWidth - width, 30 }, // topRight
|
||||
{ 0, screenHeight - 34 - height }, // bottomLeft
|
||||
{ screenWidth - width, screenHeight - 34 - height }, // bottomRight
|
||||
{ 0, 30 }, // topLeft
|
||||
{ screenSize.width - windowSize.width, 30 }, // topRight
|
||||
{ 0, screenSize.height - 34 - windowSize.height }, // bottomLeft
|
||||
{ screenSize.width - windowSize.width, screenSize.height - 34 - windowSize.height }, // bottomRight
|
||||
};
|
||||
|
||||
for (const auto& cornerPos : cornerPositions)
|
||||
{
|
||||
if (WindowFitsWithinSpace(cornerPos, width, height))
|
||||
if (WindowFitsWithinSpace(cornerPos, windowSize))
|
||||
{
|
||||
return ClampWindowToScreen(cornerPos, screenWidth, screenHeight, width, height);
|
||||
return ClampWindowToScreen(cornerPos, screenSize, windowSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,9 +775,9 @@ public:
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsWithinSpace(screenPos, width, height))
|
||||
if (WindowFitsWithinSpace(screenPos, windowSize))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
return ClampWindowToScreen(screenPos, screenSize, windowSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -802,9 +800,9 @@ public:
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsOnScreen(screenPos, width, height))
|
||||
if (WindowFitsOnScreen(screenPos, windowSize))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
return ClampWindowToScreen(screenPos, screenSize, windowSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -820,36 +818,37 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
return ClampWindowToScreen(screenPos, screenSize, windowSize);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height)
|
||||
static ScreenCoordsXY GetCentrePositionForNewWindow(ScreenSize size)
|
||||
{
|
||||
auto& uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext.GetWidth();
|
||||
auto screenHeight = uiContext.GetHeight();
|
||||
return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(kTopToolbarHeight + 1, (screenHeight - height) / 2) };
|
||||
return ScreenCoordsXY{ (screenWidth - size.width) / 2,
|
||||
std::max(kTopToolbarHeight + 1, (screenHeight - size.height) / 2) };
|
||||
}
|
||||
|
||||
WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, ScreenSize windowSize,
|
||||
WindowFlags flags) override
|
||||
{
|
||||
height += wp->getTitleBarDiffTarget();
|
||||
windowSize.height += wp->getTitleBarDiffTarget();
|
||||
|
||||
if (flags & WF_AUTO_POSITION)
|
||||
{
|
||||
if (flags & WF_CENTRE_SCREEN)
|
||||
{
|
||||
pos = GetCentrePositionForNewWindow(width, height);
|
||||
pos = GetCentrePositionForNewWindow(windowSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = GetAutoPositionForNewWindow(width, height);
|
||||
pos = GetAutoPositionForNewWindow(windowSize);
|
||||
}
|
||||
}
|
||||
|
||||
height -= wp->getTitleBarDiffTarget();
|
||||
windowSize.height -= wp->getTitleBarDiffTarget();
|
||||
|
||||
// Check if there are any window slots left
|
||||
// include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
|
||||
@@ -907,16 +906,16 @@ public:
|
||||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (width / 2));
|
||||
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (windowSize.width / 2));
|
||||
}
|
||||
|
||||
w->windowPos = pos;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->min_width = width;
|
||||
w->max_width = width;
|
||||
w->min_height = height;
|
||||
w->max_height = height;
|
||||
w->width = windowSize.width;
|
||||
w->height = windowSize.height;
|
||||
w->min_width = windowSize.width;
|
||||
w->max_width = windowSize.width;
|
||||
w->min_height = windowSize.height;
|
||||
w->max_height = windowSize.height;
|
||||
|
||||
w->focus = std::nullopt;
|
||||
|
||||
|
||||
@@ -1141,11 +1141,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (desc.X && desc.Y)
|
||||
{
|
||||
window = windowMgr->Create<CustomWindow>(
|
||||
WindowClass::Custom, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
WindowClass::Custom, { *desc.X, *desc.Y }, { desc.Width, desc.Height }, windowFlags, owner, desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = windowMgr->Create<CustomWindow>(WindowClass::Custom, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
window = windowMgr->Create<CustomWindow>(
|
||||
WindowClass::Custom, { desc.Width, desc.Height }, windowFlags, owner, desc);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -288,6 +288,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* AboutOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<AboutWindow>(WindowClass::About, WW, WH, WF_CENTRE_SCREEN);
|
||||
return windowMgr->FocusOrCreate<AboutWindow>(WindowClass::About, { WW, WH }, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -344,6 +344,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN;
|
||||
|
||||
return windowMgr->FocusOrCreate<AssetPacksWindow>(WindowClass::AssetPacks, WW, WH, flags);
|
||||
return windowMgr->FocusOrCreate<AssetPacksWindow>(WindowClass::AssetPacks, { WW, WH }, flags);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -317,7 +317,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = windowMgr->Create<BannerWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
w = windowMgr->Create<BannerWindow>(WindowClass::Banner, { WW, WH }, 0);
|
||||
|
||||
if (w != nullptr)
|
||||
w->Initialise(number);
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t width = (ContextGetWidth() * 4) / 5;
|
||||
int32_t height = (ContextGetHeight() * 4) / 5;
|
||||
auto* newWindow = windowMgr->Create<ChangelogWindow>(
|
||||
WindowClass::Changelog, width, height, WF_CENTRE_SCREEN | WF_RESIZABLE);
|
||||
WindowClass::Changelog, { width, height }, WF_CENTRE_SCREEN | WF_RESIZABLE);
|
||||
newWindow->SetPersonality(personality);
|
||||
return newWindow;
|
||||
}
|
||||
|
||||
@@ -1352,7 +1352,7 @@ static StringId window_cheats_page_titles[] = {
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Cheats);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<CheatsWindow>(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
|
||||
window = windowMgr->Create<CheatsWindow>(WindowClass::Cheats, ScreenCoordsXY(32, 32), { WW, WH });
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<CleanSceneryWindow>(
|
||||
WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), { WW, WH }, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -227,6 +227,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* CustomCurrencyOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<CustomCurrencyWindow>(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN);
|
||||
return windowMgr->FocusOrCreate<CustomCurrencyWindow>(WindowClass::CustomCurrencyConfig, { WW, WH }, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -156,7 +156,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<DebugPaintWindow>(
|
||||
WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||
WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, { WINDOW_WIDTH, WINDOW_HEIGHT },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
|
||||
return window;
|
||||
|
||||
@@ -105,12 +105,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
windowMgr->Close(*w);
|
||||
|
||||
newWindow = windowMgr->Create<DemolishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
|
||||
WindowClass::DemolishRidePrompt, windowPos, { WW, WH }, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWindow = windowMgr->Create<DemolishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
WindowClass::DemolishRidePrompt, { WW, WH }, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
newWindow->SetRide(ride);
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Create the window (width/height position are set later)
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<DropdownWindow>(
|
||||
WindowClass::Dropdown, width, customItemHeight, WF_STICK_TO_FRONT | WF_NO_TITLE_BAR);
|
||||
WindowClass::Dropdown, { width, customItemHeight }, WF_STICK_TO_FRONT | WF_NO_TITLE_BAR);
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto numRowsPerColumn = prefRowsPerColumn > 0 ? static_cast<int32_t>(prefRowsPerColumn) : Dropdown::kItemsMaxSize;
|
||||
@@ -400,7 +400,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Create the window (width/height position are set later)
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<DropdownWindow>(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT);
|
||||
auto* w = windowMgr->Create<DropdownWindow>(WindowClass::Dropdown, { itemWidth, itemHeight }, WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns);
|
||||
|
||||
@@ -446,7 +446,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<EditorBottomToolbarWindow>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32,
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), { ContextGetWidth(), 32 },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
|
||||
return window;
|
||||
|
||||
@@ -588,7 +588,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<InventionListWindow>(
|
||||
WindowClass::EditorInventionList, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
WindowClass::EditorInventionList, { WW, WH }, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
@@ -686,7 +686,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::EditorInventionListDrag);
|
||||
auto* wnd = windowMgr->Create<InventionDragWindow>(
|
||||
WindowClass::EditorInventionListDrag, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING);
|
||||
WindowClass::EditorInventionListDrag, { 10, 14 }, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING);
|
||||
if (wnd != nullptr)
|
||||
{
|
||||
wnd->Init(*researchItem, editorPos, objectSelectionScrollWidth);
|
||||
|
||||
@@ -1631,7 +1631,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<EditorObjectSelectionWindow>(
|
||||
WindowClass::EditorObjectSelection, 755, 400, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
WindowClass::EditorObjectSelection, { 755, 400 }, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
// Used for forced closure
|
||||
|
||||
@@ -396,7 +396,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return window;
|
||||
|
||||
window = windowMgr->Create<EditorParkEntrance>(
|
||||
WindowClass::EditorParkEntrance, kWindowWidth, kWindowHeight, WF_10 | WF_RESIZABLE);
|
||||
WindowClass::EditorParkEntrance, { kWindowWidth, kWindowHeight }, WF_10 | WF_RESIZABLE);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -2370,6 +2370,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<EditorScenarioOptionsWindow>(
|
||||
WindowClass::EditorScenarioOptions, 280, 148, WF_NO_SCROLLING | WF_CENTRE_SCREEN);
|
||||
WindowClass::EditorScenarioOptions, { 280, 148 }, WF_NO_SCROLLING | WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -142,7 +142,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto errorWindow = std::make_unique<ErrorWindow>(std::move(buffer), numLines, autoClose);
|
||||
|
||||
return windowMgr->Create(
|
||||
std::move(errorWindow), WindowClass::Error, windowPosition, width, height,
|
||||
std::move(errorWindow), WindowClass::Error, windowPosition, { width, height },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
|
||||
|
||||
@@ -881,7 +881,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
static FinancesWindow* FinancesWindowOpen(uint8_t page)
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, kHeightSummary, WF_10);
|
||||
auto* window = windowMgr->FocusOrCreate<FinancesWindow>(
|
||||
WindowClass::Finances, { WW_OTHER_TABS, kHeightSummary }, WF_10);
|
||||
|
||||
if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY)
|
||||
window->SetPage(page);
|
||||
@@ -892,7 +893,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* FinancesOpen()
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, kHeightSummary, WF_10);
|
||||
return windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, { WW_OTHER_TABS, kHeightSummary }, WF_10);
|
||||
}
|
||||
|
||||
WindowBase* FinancesResearchOpen()
|
||||
|
||||
@@ -1634,7 +1634,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<FootpathWindow>(WindowClass::Footpath, WW_WINDOW, WH_WINDOW, 0);
|
||||
return windowMgr->FocusOrCreate<FootpathWindow>(WindowClass::Footpath, { WW_WINDOW, WH_WINDOW }, 0);
|
||||
}
|
||||
|
||||
void WindowFootpathResetSelectedPath()
|
||||
|
||||
@@ -687,11 +687,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Figure out how much line height we have to work with.
|
||||
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
|
||||
uint32_t toolbar_height = line_height * 2 + 12;
|
||||
int32_t toolbar_height = line_height * 2 + 12;
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<GameBottomToolbar>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, screenHeight - toolbar_height), screenWidth, toolbar_height,
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, screenHeight - toolbar_height), { screenWidth, toolbar_height },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
|
||||
return window;
|
||||
|
||||
@@ -1916,7 +1916,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (Config::Get().general.DebuggingTools)
|
||||
windowWidth += TabWidth;
|
||||
|
||||
window = windowMgr->Create<GuestWindow>(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE);
|
||||
window = windowMgr->Create<GuestWindow>(WindowClass::Peep, { windowWidth, 157 }, WF_RESIZABLE);
|
||||
if (window == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
|
||||
@@ -955,7 +955,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::GuestList);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<GuestListWindow>(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE);
|
||||
window = windowMgr->Create<GuestListWindow>(WindowClass::GuestList, { 350, 330 }, WF_10 | WF_RESIZABLE);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
_currentTrackPieceDirection = 2;
|
||||
|
||||
auto* window = windowMgr->FocusOrCreate<InstallTrackWindow>(
|
||||
WindowClass::InstallTrack, WW, WH, WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
WindowClass::InstallTrack, { WW, WH }, WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
window->SetupTrack(path, std::move(trackDesign));
|
||||
|
||||
return window;
|
||||
|
||||
@@ -868,7 +868,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* LandOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<LandWindow>(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
return windowMgr->FocusOrCreate<LandWindow>(
|
||||
WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), { WW, WH }, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -592,6 +592,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<LandRightsWindow>(
|
||||
WindowClass::LandRights, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
WindowClass::LandRights, ScreenCoordsXY(ContextGetWidth() - WW, 29), { WW, WH }, 0);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -1135,8 +1135,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto height = config.FileBrowserHeight;
|
||||
|
||||
w = windowMgr->Create<LoadSaveWindow>(
|
||||
WindowClass::Loadsave, width, height, WF_STICK_TO_FRONT | WF_RESIZABLE | WF_AUTO_POSITION | WF_CENTRE_SCREEN,
|
||||
action, type);
|
||||
WindowClass::Loadsave, { width, height },
|
||||
WF_STICK_TO_FRONT | WF_RESIZABLE | WF_AUTO_POSITION | WF_CENTRE_SCREEN, action, type);
|
||||
}
|
||||
|
||||
bool isSave = action == LoadSaveAction::save;
|
||||
|
||||
@@ -78,6 +78,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<MainWindow>(
|
||||
WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK | WF_NO_TITLE_BAR);
|
||||
WindowClass::MainWindow, { 0, 0 }, { ContextGetWidth(), ContextGetHeight() }, WF_STICK_TO_BACK | WF_NO_TITLE_BAR);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -1255,7 +1255,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
try
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FocusOrCreate<MapWindow>(WindowClass::Map, 245, 259, WF_10);
|
||||
auto* w = windowMgr->FocusOrCreate<MapWindow>(WindowClass::Map, { 245, 259 }, WF_10);
|
||||
w->selected_tab = 0;
|
||||
w->list_information_type = 0;
|
||||
return w;
|
||||
|
||||
@@ -1535,7 +1535,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<MapGenWindow>(
|
||||
WindowClass::Mapgen, kWindowSize.width, kWindowSize.height, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
WindowClass::Mapgen, kWindowSize, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
static void HeightmapLoadsaveCallback(ModalResult result, const utf8* path)
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
else
|
||||
{
|
||||
w = windowMgr->Create<MapTooltip>(
|
||||
WindowClass::MapTooltip, pos, width, height,
|
||||
WindowClass::MapTooltip, pos, { width, height },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<MazeConstructionWindow>(
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), { WW, WH }, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
|
||||
void WindowMazeConstructionUpdatePressedWidgets()
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<MultiplayerWindow>(
|
||||
WindowClass::Multiplayer, 320, 144, WF_10 | WF_RESIZABLE | WF_AUTO_POSITION);
|
||||
WindowClass::Multiplayer, { 320, 144 }, WF_10 | WF_RESIZABLE | WF_AUTO_POSITION);
|
||||
}
|
||||
|
||||
return window;
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
else
|
||||
{
|
||||
window = windowMgr->Create<NetworkStatusWindow>(
|
||||
WindowClass::NetworkStatus, 400, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
WindowClass::NetworkStatus, { 400, 90 }, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
}
|
||||
|
||||
window->SetCloseCallBack(onClose);
|
||||
@@ -163,7 +163,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<NetworkStatusWindow>(
|
||||
WindowClass::NetworkStatus, 400, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN);
|
||||
WindowClass::NetworkStatus, { 400, 90 }, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN);
|
||||
|
||||
char password[33]{};
|
||||
WindowTextInputRawOpen(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, {}, password, 32);
|
||||
|
||||
@@ -408,7 +408,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
w->Close();
|
||||
}
|
||||
|
||||
w = windowMgr->Create<NewCampaignWindow>(WindowClass::NewCampaign, WW, WH, 0);
|
||||
w = windowMgr->Create<NewCampaignWindow>(WindowClass::NewCampaign, { WW, WH }, 0);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetCampaign(campaignType);
|
||||
|
||||
@@ -1085,7 +1085,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
windowMgr->CloseByClass(WindowClass::TrackDesignPlace);
|
||||
|
||||
window = windowMgr->Create<NewRideWindow>(
|
||||
WindowClass::ConstructRide, WindowWidth, kWindowHeight, WF_10 | WF_AUTO_POSITION);
|
||||
WindowClass::ConstructRide, { WindowWidth, kWindowHeight }, WF_10 | WF_AUTO_POSITION);
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
@@ -582,6 +582,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* NewsOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<NewsWindow>(WindowClass::RecentNews, WW, WH, 0);
|
||||
return windowMgr->FocusOrCreate<NewsWindow>(WindowClass::RecentNews, { WW, WH }, 0);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -578,7 +578,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ObjectLoadError);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<ObjectLoadErrorWindow>(WindowClass::ObjectLoadError, WW, WH, 0);
|
||||
window = windowMgr->Create<ObjectLoadErrorWindow>(WindowClass::ObjectLoadError, { WW, WH }, 0);
|
||||
}
|
||||
|
||||
static_cast<ObjectLoadErrorWindow*>(window)->Initialise(path, numMissingObjects, missingObjects);
|
||||
|
||||
@@ -2430,6 +2430,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* OptionsOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<OptionsWindow>(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN);
|
||||
return windowMgr->FocusOrCreate<OptionsWindow>(WindowClass::Options, { WW, WH }, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -107,7 +107,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
windowMgr->CloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
|
||||
return windowMgr->Create<OverwritePromptWindow>(
|
||||
WindowClass::LoadsaveOverwritePrompt, OVERWRITE_WW, OVERWRITE_WH,
|
||||
WindowClass::LoadsaveOverwritePrompt, { OVERWRITE_WW, OVERWRITE_WH },
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN, name, path, action, type, trackDesignPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1310,7 +1310,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static ParkWindow* ParkWindowOpen(uint8_t page)
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* wnd = windowMgr->FocusOrCreate<ParkWindow>(WindowClass::ParkInformation, 230, 174 + 9, WF_10);
|
||||
auto* wnd = windowMgr->FocusOrCreate<ParkWindow>(WindowClass::ParkInformation, { 230, 174 + 9 }, WF_10);
|
||||
if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE)
|
||||
{
|
||||
wnd->OnMouseUp(WIDX_TAB_1 + page);
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FocusOrCreate<PatrolAreaWindow>(
|
||||
WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - WW, 29), { WW, WH }, 0);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetStaffId(staffId);
|
||||
|
||||
@@ -629,7 +629,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* window = static_cast<PlayerWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Player, id));
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<PlayerWindow>(WindowClass::Player, 240, 170, WF_RESIZABLE);
|
||||
window = windowMgr->Create<PlayerWindow>(WindowClass::Player, { 240, 170 }, WF_RESIZABLE);
|
||||
}
|
||||
|
||||
window->Init(id);
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
else
|
||||
{
|
||||
window = windowMgr->Create<ProgressWindow>(
|
||||
WindowClass::ProgressWindow, kWindowWidth, kWindowHeight,
|
||||
WindowClass::ProgressWindow, { kWindowWidth, kWindowHeight },
|
||||
WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,12 +104,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
windowMgr->Close(*w);
|
||||
|
||||
newWindow = windowMgr->Create<RefurbishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
|
||||
WindowClass::DemolishRidePrompt, windowPos, { WW, WH }, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWindow = windowMgr->Create<RefurbishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
WindowClass::DemolishRidePrompt, { WW, WH }, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
newWindow->SetRide(ride);
|
||||
|
||||
@@ -298,7 +298,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* ResearchOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<ResearchWindow>(WindowClass::Research, WW_DEVELOPMENT, WH_DEVELOPMENT, WF_10);
|
||||
auto* window = windowMgr->FocusOrCreate<ResearchWindow>(
|
||||
WindowClass::Research, { WW_DEVELOPMENT, WH_DEVELOPMENT }, WF_10);
|
||||
window->SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT);
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -6954,7 +6954,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static RideWindow* WindowRideOpen(const Ride& ride)
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<RideWindow>(WindowClass::Ride, kMinimumWindowWidth, 207, WF_10 | WF_RESIZABLE, ride);
|
||||
return windowMgr->Create<RideWindow>(WindowClass::Ride, { kMinimumWindowWidth, 207 }, WF_10 | WF_RESIZABLE, ride);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2842,10 +2842,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
return ContextOpenWindowView(WV_MAZE_CONSTRUCTION);
|
||||
case RideConstructionWindowContext::Default:
|
||||
return windowMgr->Create<RideConstructionWindow>(
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), { WW, WH }, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
return windowMgr->Create<RideConstructionWindow>(
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), { WW, WH }, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
|
||||
static void CloseConstructWindowOnCompletion(const Ride& ride)
|
||||
|
||||
@@ -1007,7 +1007,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<RideListWindow>(
|
||||
WindowClass::RideList, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE);
|
||||
WindowClass::RideList, ScreenCoordsXY(32, 32), { WW, WH }, WF_10 | WF_RESIZABLE);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto savePromptWindow = std::make_unique<SavePromptWindow>(prompt_mode);
|
||||
return windowMgr->Create(
|
||||
std::move(savePromptWindow), WindowClass::SavePrompt, {}, width, height,
|
||||
std::move(savePromptWindow), WindowClass::SavePrompt, {}, { width, height },
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN | WF_AUTO_POSITION);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -934,7 +934,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ScreenCoordsXY screenPos = { (screenWidth - kWindowWidth) / 2,
|
||||
std::max(kTopToolbarHeight + 1, (screenHeight - kWindowHeight) / 2) };
|
||||
window = windowMgr->Create<ScenarioSelectWindow>(
|
||||
WindowClass::ScenarioSelect, screenPos, kWindowWidth, kWindowHeight, 0, callback);
|
||||
WindowClass::ScenarioSelect, screenPos, { kWindowWidth, kWindowHeight }, 0, callback);
|
||||
return window;
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -203,7 +203,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* window = windowMgr->FindByClass(WindowClass::SceneryScatter);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<SceneryScatterWindow>(WindowClass::SceneryScatter, 86, 100, 0);
|
||||
window = windowMgr->Create<SceneryScatterWindow>(WindowClass::SceneryScatter, { 86, 100 }, 0);
|
||||
}
|
||||
|
||||
return window;
|
||||
|
||||
@@ -545,7 +545,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return window;
|
||||
|
||||
window = windowMgr->Create<ServerListWindow>(
|
||||
WindowClass::ServerList, kWindowWidthMin, kWindowHeightMin, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
WindowClass::ServerList, { kWindowWidthMin, kWindowHeightMin }, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* ServerStartOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<ServerStartWindow>(WindowClass::ServerStart, WW, WH, WF_CENTRE_SCREEN);
|
||||
return windowMgr->FocusOrCreate<ServerStartWindow>(WindowClass::ServerStart, { WW, WH }, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::ChangeKeyboardShortcut);
|
||||
auto* w = windowMgr->Create<ChangeShortcutWindow>(
|
||||
WindowClass::ChangeKeyboardShortcut, CHANGE_WW, CHANGE_WH, WF_CENTRE_SCREEN);
|
||||
WindowClass::ChangeKeyboardShortcut, { CHANGE_WW, CHANGE_WH }, WF_CENTRE_SCREEN);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->_shortcutId = shortcutId;
|
||||
@@ -558,7 +558,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto w = windowMgr->BringToFrontByClass(WindowClass::KeyboardShortcutList);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = windowMgr->Create<ShortcutKeysWindow>(WindowClass::KeyboardShortcutList, WW, WH, WF_RESIZABLE);
|
||||
w = windowMgr->Create<ShortcutKeysWindow>(WindowClass::KeyboardShortcutList, { WW, WH }, WF_RESIZABLE);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
@@ -620,7 +620,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<ResetShortcutKeysPrompt>(
|
||||
WindowClass::ResetShortcutKeysPrompt, RESET_PROMPT_WW, RESET_PROMPT_WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
WindowClass::ResetShortcutKeysPrompt, { RESET_PROMPT_WW, RESET_PROMPT_WH }, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
#pragma endregion
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -336,7 +336,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = windowMgr->Create<SignWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
w = windowMgr->Create<SignWindow>(WindowClass::Banner, { WW, WH }, 0);
|
||||
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
@@ -360,7 +360,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = windowMgr->Create<SignWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
w = windowMgr->Create<SignWindow>(WindowClass::Banner, { WW, WH }, 0);
|
||||
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
||||
@@ -1227,7 +1227,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = windowMgr->Create<StaffWindow>(WindowClass::Peep, WW, WH, WF_10 | WF_RESIZABLE);
|
||||
w = windowMgr->Create<StaffWindow>(WindowClass::Peep, { WW, WH }, WF_10 | WF_RESIZABLE);
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Check if the confirm window already exists
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<StaffFirePromptWindow>(
|
||||
WindowClass::FirePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
WindowClass::FirePrompt, { WW, WH }, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
window->SetWindowNumber(peep->Id.ToUnderlying());
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -725,7 +725,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* StaffListOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<StaffListWindow>(WindowClass::StaffList, WW, WH, WF_10 | WF_RESIZABLE);
|
||||
return windowMgr->FocusOrCreate<StaffListWindow>(WindowClass::StaffList, { WW, WH }, WF_10 | WF_RESIZABLE);
|
||||
}
|
||||
|
||||
void WindowStaffListRefresh()
|
||||
|
||||
@@ -369,7 +369,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::Textinput);
|
||||
|
||||
auto w = windowMgr->Create<TextInputWindow>(WindowClass::Textinput, WW, WH + 10, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
auto w = windowMgr->Create<TextInputWindow>(
|
||||
WindowClass::Textinput, { WW, WH + 10 }, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetParentWindow(call_w, call_widget);
|
||||
@@ -383,7 +384,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
std::function<void(std::string_view)> callback, std::function<void()> cancelCallback)
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->Create<TextInputWindow>(WindowClass::Textinput, WW, WH + 10, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
auto w = windowMgr->Create<TextInputWindow>(
|
||||
WindowClass::Textinput, { WW, WH + 10 }, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetTitle(title, description);
|
||||
|
||||
@@ -908,7 +908,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = windowMgr->Create<ThemesWindow>(WindowClass::Themes, 320, 107, WF_10 | WF_RESIZABLE);
|
||||
window = windowMgr->Create<ThemesWindow>(WindowClass::Themes, { 320, 107 }, WF_10 | WF_RESIZABLE);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -2440,7 +2440,8 @@ static uint64_t PageDisabledWidgets[] = {
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->BringToFrontByClass(WindowClass::TileInspector);
|
||||
if (window == nullptr)
|
||||
window = windowMgr->Create<TileInspector>(WindowClass::TileInspector, ScreenCoordsXY(0, 29), WW, WH, WF_RESIZABLE);
|
||||
window = windowMgr->Create<TileInspector>(
|
||||
WindowClass::TileInspector, ScreenCoordsXY(0, 29), { WW, WH }, WF_RESIZABLE);
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<TitleExitWindow>(
|
||||
WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), 40, 64,
|
||||
WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), { 40, 64 },
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<TitleLogoWindow>(
|
||||
WindowClass::TitleLogo, ScreenCoordsXY(0, 0), WW, WH, WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
WindowClass::TitleLogo, ScreenCoordsXY(0, 0), { WW, WH }, WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<TitleMenuWindow>(
|
||||
WindowClass::TitleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), 0, windowHeight,
|
||||
WindowClass::TitleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), { 0, windowHeight },
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -57,7 +57,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<TitleOptionsWindow>(
|
||||
WindowClass::TitleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), 80, 15,
|
||||
WindowClass::TitleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), { 80, 15 },
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<TitleVersionWindow>(
|
||||
WindowClass::TitleVersion, ScreenCoordsXY(kTextOffset, ContextGetHeight() - 30), WW, WH,
|
||||
WindowClass::TitleVersion, ScreenCoordsXY(kTextOffset, ContextGetHeight() - 30), { WW, WH },
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
return window;
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->Create(
|
||||
std::move(tooltipWindow), WindowClass::Tooltip, windowPos, width, height,
|
||||
std::move(tooltipWindow), WindowClass::Tooltip, windowPos, { width, height },
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
|
||||
|
||||
@@ -1012,7 +1012,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<TopToolbar>(
|
||||
WindowClass::TopToolbar, ScreenCoordsXY(0, 0), ContextGetWidth(), kTopToolbarHeight + 1,
|
||||
WindowClass::TopToolbar, ScreenCoordsXY(0, 0), { ContextGetWidth(), kTopToolbarHeight + 1 },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
|
||||
window->SetWidgets(_topToolbarWidgets);
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto trackDesignManageWindow = std::make_unique<TrackDesignManageWindow>(tdFileRef);
|
||||
|
||||
auto* window = windowMgr->Create(
|
||||
std::move(trackDesignManageWindow), WindowClass::ManageTrackDesign, {}, WW, WH,
|
||||
std::move(trackDesignManageWindow), WindowClass::ManageTrackDesign, {}, { WW, WH },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_AUTO_POSITION);
|
||||
|
||||
return window;
|
||||
@@ -192,7 +192,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto trackDeletePromptWindow = std::make_unique<TrackDeletePromptWindow>(tdFileRef);
|
||||
|
||||
windowMgr->Create(
|
||||
std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt, {}, WW_DELETE_PROMPT, WH_DELETE_PROMPT,
|
||||
std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt, {}, { WW_DELETE_PROMPT, WH_DELETE_PROMPT },
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
|
||||
@@ -732,7 +732,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseConstructionWindows();
|
||||
|
||||
auto* window = windowMgr->FocusOrCreate<TrackDesignPlaceWindow>(WindowClass::TrackDesignPlace, WW, WH, 0);
|
||||
auto* window = windowMgr->FocusOrCreate<TrackDesignPlaceWindow>(WindowClass::TrackDesignPlace, { WW, WH }, 0);
|
||||
if (window != nullptr)
|
||||
{
|
||||
window->Init(std::move(openTrackDesign));
|
||||
|
||||
@@ -767,7 +767,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
screenPos = { 0, kTopToolbarHeight + 2 };
|
||||
}
|
||||
|
||||
return windowMgr->Create<TrackListWindow>(WindowClass::TrackDesignList, screenPos, WW, WH, flags, item);
|
||||
return windowMgr->Create<TrackListWindow>(WindowClass::TrackDesignList, screenPos, { WW, WH }, flags, item);
|
||||
}
|
||||
|
||||
void WindowTrackDesignListReloadTracks()
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Transparency);
|
||||
if (window == nullptr)
|
||||
window = windowMgr->Create<TransparencyWindow>(WindowClass::Transparency, ScreenCoordsXY(32, 32), WW, WH);
|
||||
window = windowMgr->Create<TransparencyWindow>(WindowClass::Transparency, ScreenCoordsXY(32, 32), { WW, WH });
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ViewClipping);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<ViewClippingWindow>(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), WW, WH);
|
||||
window = windowMgr->Create<ViewClippingWindow>(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), { WW, WH });
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -216,6 +216,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
WindowBase* ViewportOpen()
|
||||
{
|
||||
return GetWindowManager()->Create<ViewportWindow>(WindowClass::Viewport, WW, WH, WF_RESIZABLE);
|
||||
return GetWindowManager()->Create<ViewportWindow>(WindowClass::Viewport, { WW, WH }, WF_RESIZABLE);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -425,7 +425,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* WaterOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<WaterWindow>(WindowClass::Water, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
return windowMgr->FocusOrCreate<WaterWindow>(
|
||||
WindowClass::Water, ScreenCoordsXY(ContextGetWidth() - WW, 29), { WW, WH }, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,8 +72,7 @@ namespace OpenRCT2::Ui
|
||||
}
|
||||
|
||||
WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
WindowFlags flags) override
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, ScreenSize size, WindowFlags flags) override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -44,43 +44,40 @@ namespace OpenRCT2::Ui
|
||||
virtual WindowBase* GetOwner(const Viewport* viewport) = 0;
|
||||
|
||||
virtual WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
WindowFlags flags)
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, ScreenSize size, WindowFlags flags)
|
||||
= 0;
|
||||
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* Create(
|
||||
WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, WindowFlags flags = 0,
|
||||
TArgs&&... args)
|
||||
T* Create(WindowClass cls, const ScreenCoordsXY& pos = {}, ScreenSize size = {}, WindowFlags flags = 0, TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(Create(std::make_unique<T>(std::forward<TArgs>(args)...), cls, pos, width, height, flags));
|
||||
return static_cast<T*>(Create(std::make_unique<T>(std::forward<TArgs>(args)...), cls, pos, size, flags));
|
||||
}
|
||||
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* Create(WindowClass cls, int32_t width, int32_t height, WindowFlags flags, TArgs&&... args)
|
||||
T* Create(WindowClass cls, ScreenSize size, WindowFlags flags, TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(
|
||||
Create(std::make_unique<T>(std::forward<TArgs>(args)...), cls, {}, width, height, flags | WF_AUTO_POSITION));
|
||||
Create(std::make_unique<T>(std::forward<TArgs>(args)...), cls, {}, size, flags | WF_AUTO_POSITION));
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, WindowFlags flags = 0)
|
||||
T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, ScreenSize size, WindowFlags flags = 0)
|
||||
{
|
||||
auto* w = BringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = Create<T>(cls, pos, width, height, flags);
|
||||
w = Create<T>(cls, pos, size, flags);
|
||||
}
|
||||
return static_cast<T*>(w);
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* FocusOrCreate(WindowClass cls, int32_t width, int32_t height, WindowFlags flags = 0)
|
||||
T* FocusOrCreate(WindowClass cls, ScreenSize size, WindowFlags flags = 0)
|
||||
{
|
||||
auto* w = BringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = Create<T>(cls, width, height, flags);
|
||||
w = Create<T>(cls, size, flags);
|
||||
}
|
||||
return static_cast<T*>(w);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user