mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Refactor window offset std::arrays into regular arrays (#12799)
This commit is contained in:
@@ -194,11 +194,11 @@ rct_window* window_create_auto_pos(
|
|||||||
auto screenHeight = uiContext->GetHeight();
|
auto screenHeight = uiContext->GetHeight();
|
||||||
|
|
||||||
// Place window in an empty corner of the screen
|
// Place window in an empty corner of the screen
|
||||||
const std::array<ScreenCoordsXY, 4> cornerPositions = {
|
const ScreenCoordsXY cornerPositions[] = {
|
||||||
ScreenCoordsXY{ 0, 30 }, // topLeft
|
{ 0, 30 }, // topLeft
|
||||||
ScreenCoordsXY{ screenWidth - width, 30 }, // topRight
|
{ screenWidth - width, 30 }, // topRight
|
||||||
ScreenCoordsXY{ 0, screenHeight - 34 - height }, // bottomLeft
|
{ 0, screenHeight - 34 - height }, // bottomLeft
|
||||||
ScreenCoordsXY{ screenWidth - width, screenHeight - 34 - height } // bottomRight
|
{ screenWidth - width, screenHeight - 34 - height } // bottomRight
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& cornerPos : cornerPositions)
|
for (const auto& cornerPos : cornerPositions)
|
||||||
@@ -212,14 +212,16 @@ rct_window* window_create_auto_pos(
|
|||||||
{
|
{
|
||||||
if (w->flags & WF_STICK_TO_BACK)
|
if (w->flags & WF_STICK_TO_BACK)
|
||||||
continue;
|
continue;
|
||||||
const std::array<ScreenCoordsXY, 8> offsets = { ScreenCoordsXY{ w->width + 2, 0 },
|
|
||||||
ScreenCoordsXY{ -w->width - 2, 0 },
|
const ScreenCoordsXY offsets[] = { { w->width + 2, 0 },
|
||||||
ScreenCoordsXY{ 0, w->height + 2 },
|
{ -w->width - 2, 0 },
|
||||||
ScreenCoordsXY{ 0, -w->height - 2 },
|
{ 0, w->height + 2 },
|
||||||
ScreenCoordsXY{ w->width + 2, -w->height - 2 },
|
{ 0, -w->height - 2 },
|
||||||
ScreenCoordsXY{ -w->width - 2, -w->height - 2 },
|
{ w->width + 2, -w->height - 2 },
|
||||||
ScreenCoordsXY{ w->width + 2, w->height + 2 },
|
{ -w->width - 2, -w->height - 2 },
|
||||||
ScreenCoordsXY{ -w->width - 2, w->height + 2 } };
|
{ w->width + 2, w->height + 2 },
|
||||||
|
{ -w->width - 2, w->height + 2 } };
|
||||||
|
|
||||||
for (const auto& offset : offsets)
|
for (const auto& offset : offsets)
|
||||||
{
|
{
|
||||||
auto screenPos = w->windowPos + offset;
|
auto screenPos = w->windowPos + offset;
|
||||||
@@ -236,10 +238,12 @@ rct_window* window_create_auto_pos(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const std::array<ScreenCoordsXY, 4> offsets = { ScreenCoordsXY{ w->width + 2, 0 },
|
const ScreenCoordsXY offsets[] = {
|
||||||
ScreenCoordsXY{ -w->width - 2, 0 },
|
{ w->width + 2, 0 },
|
||||||
ScreenCoordsXY{ 0, w->height + 2 },
|
{ -w->width - 2, 0 },
|
||||||
ScreenCoordsXY{ 0, -w->height - 2 } };
|
{ 0, w->height + 2 },
|
||||||
|
{ 0, -w->height - 2 }
|
||||||
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
for (const auto& offset : offsets)
|
for (const auto& offset : offsets)
|
||||||
|
|||||||
Reference in New Issue
Block a user