diff --git a/src/openrct2-ui/interface/Widget.h b/src/openrct2-ui/interface/Widget.h index 1d5d13efa0..f0d72c55e5 100644 --- a/src/openrct2-ui/interface/Widget.h +++ b/src/openrct2-ui/interface/Widget.h @@ -15,20 +15,6 @@ #include #include -// clang-format off -#define WINDOW_SHIM(TITLE, WIDTH, HEIGHT) \ - { WindowWidgetType::Frame, 0, 0, WIDTH - 1, 0, HEIGHT - 1, 0xFFFFFFFF, kStringIdNone }, \ - { WindowWidgetType::Caption, 0, 1, WIDTH - 2, 1, 14, TITLE, STR_WINDOW_TITLE_TIP }, \ - { .type = WindowWidgetType::CloseBox, \ - .colour = 0, \ - .left = WIDTH - 13, \ - .right = WIDTH - 3, \ - .top = 2, \ - .bottom = 13, \ - .string = kCloseBoxStringBlackNormal, \ - .tooltip = STR_CLOSE_WINDOW_TIP } -// clang-format on - namespace OpenRCT2::Ui { ImageId GetColourButtonImage(colour_t colour); @@ -122,10 +108,83 @@ namespace OpenRCT2::Ui return out; } -// NOLINTBEGIN -#define MakeSpinnerWidgets(...) \ - MakeWidget(__VA_ARGS__), MakeSpinnerIncreaseWidget(__VA_ARGS__), MakeSpinnerDecreaseWidget(__VA_ARGS__) - // NOLINTEND + namespace Detail + { + template + struct WidgetsCount + { + static constexpr size_t count = 0; + }; + + template + struct WidgetsCount>> + { + static constexpr size_t count = 1; + }; + + template + struct WidgetsCount, std::enable_if_t>> + { + static constexpr size_t count = N; + }; + + template + struct IsWidgetsArray : std::false_type + { + }; + + template + struct IsWidgetsArray> : std::true_type + { + }; + } // namespace Detail + + template + constexpr auto makeWidgets(TArgs&&... args) + { + constexpr auto totalCount = [&]() { + size_t count = 0; + ((count += Detail::WidgetsCount>::count), ...); + return count; + }(); + + std::array res{}; + size_t index = 0; + + const auto append = [&](auto&& val) { + if constexpr (Detail::IsWidgetsArray>::value) + { + for (auto&& widget : val) + { + res[index] = std::move(widget); + index++; + } + } + else + { + res[index] = std::move(val); + index++; + } + }; + + ((append(args)), ...); + + return res; + } + + constexpr std::array makeWindowShim(StringId title, int16_t width, int16_t height) + { + // clang-format off + std::array out = { + MakeWidget({ 0, 0 }, { width, height }, WindowWidgetType::Frame, WindowColour::Primary), + MakeWidget({ 1, 1 }, { width - 1, kTitleHeightNormal }, WindowWidgetType::Caption, WindowColour::Primary, title, STR_WINDOW_TITLE_TIP), + MakeWidget({ width - 12, 2 }, { 11, 11 }, WindowWidgetType::CloseBox, WindowColour::Primary, kWidgetContentEmpty, STR_CLOSE_WINDOW_TIP), + }; + // clang-format on + + out[2].string = kCloseBoxStringBlackNormal; + return out; + } constexpr Widget MakeSpinnerDecreaseWidget( const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, @@ -151,8 +210,15 @@ namespace OpenRCT2::Ui return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_NUMERIC_UP, tooltip); } -// NOLINTNEXTLINE -#define MakeDropdownWidgets(...) MakeDropdownBoxWidget(__VA_ARGS__), MakeDropdownButtonWidget(__VA_ARGS__) + constexpr std::array MakeSpinnerWidgets( + const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, + uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone) + { + return makeWidgets( + MakeWidget(origin, size, type, colour, content, tooltip), + MakeSpinnerIncreaseWidget(origin, size, type, colour, content, tooltip), + MakeSpinnerDecreaseWidget(origin, size, type, colour, content, tooltip)); + }; constexpr Widget MakeDropdownBoxWidget( const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour, @@ -173,6 +239,15 @@ namespace OpenRCT2::Ui return MakeWidget({ xPos, yPos }, { width, height }, WindowWidgetType::Button, colour, STR_DROPDOWN_GLYPH, tooltip); } + constexpr std::array MakeDropdownWidgets( + const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, uint32_t content, + StringId tooltip = kStringIdNone) + { + return makeWidgets( + MakeDropdownBoxWidget(origin, size, type, colour, content, tooltip), + MakeDropdownButtonWidget(origin, size, type, colour, content, tooltip)); + }; + void WidgetDraw(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex); bool WidgetIsDisabled(const WindowBase& w, WidgetIndex widgetIndex); diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 6f489b55b8..77776f28bb 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -45,10 +45,10 @@ namespace OpenRCT2::Ui::Windows WIDX_TAB_0, }; - static Widget CustomDefaultWidgets[] = { - WINDOW_SHIM(STR_STRING, 50, 50), - MakeWidget({ 0, 14 }, { 50, 36 }, WindowWidgetType::Resize, WindowColour::Secondary), // content panel - }; + static auto CustomDefaultWidgets = makeWidgets( + makeWindowShim(STR_STRING, 50, 50), + MakeWidget({ 0, 14 }, { 50, 36 }, WindowWidgetType::Resize, WindowColour::Secondary) // content panel + ); struct CustomWidgetDesc { diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 5eb639b36f..77d1f5c3df 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -58,15 +58,15 @@ namespace OpenRCT2::Ui::Windows WIDX_CONTRIBUTORS_BUTTON, }; -#define WIDGETS_MAIN \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, TABHEIGHT }, { WW, WH - TABHEIGHT }, WindowWidgetType::Frame, WindowColour::Secondary), \ - MakeRemapWidget({ 3, 17 }, { 91, TABHEIGHT - 16 }, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB_LARGE), \ - MakeRemapWidget({ 94, 17 }, { 91, TABHEIGHT - 16 }, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB_LARGE) + static constexpr auto kMainWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), + MakeWidget({ 0, TABHEIGHT }, { WW, WH - TABHEIGHT }, WindowWidgetType::Frame, WindowColour::Secondary), + MakeRemapWidget({ 3, 17 }, { 91, TABHEIGHT - 16 }, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB_LARGE), + MakeRemapWidget({ 94, 17 }, { 91, TABHEIGHT - 16 }, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB_LARGE)); // clang-format off - static constexpr Widget _windowAboutOpenRCT2Widgets[] = { - WIDGETS_MAIN, + static constexpr auto _windowAboutOpenRCT2Widgets = makeWidgets( + kMainWidgets, MakeWidget({10, 60}, {WW - 20, 20}, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_ABOUT_OPENRCT2_DESCRIPTION), // Introduction MakeWidget({30, 90}, {128, 128}, WindowWidgetType::Placeholder, WindowColour::Secondary, kStringIdNone), // OpenRCT2 Logo MakeWidget({168, 100}, {173, 24}, WindowWidgetType::Placeholder, WindowColour::Secondary, kStringIdNone), // Build version @@ -74,13 +74,11 @@ namespace OpenRCT2::Ui::Windows MakeWidget({168, 115 + 20}, {200, 14}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_UPDATE_AVAILABLE ), // "new version" button MakeWidget({168, 115 + 40}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGELOG_ELLIPSIS), // changelog button MakeWidget({168, 115 + 60}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_JOIN_DISCORD ), // "join discord" button - MakeWidget({168, 115 + 80}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CONTRIBUTORS_WINDOW_BUTTON), // "contributors" button - }; + MakeWidget({168, 115 + 80}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CONTRIBUTORS_WINDOW_BUTTON) // "contributors" button + ); // clang-format on - static constexpr Widget _windowAboutRCT2Widgets[] = { - WIDGETS_MAIN, - }; + static constexpr auto _windowAboutRCT2Widgets = makeWidgets(kMainWidgets); static constexpr std::span _windowAboutPageWidgets[] = { _windowAboutOpenRCT2Widgets, diff --git a/src/openrct2-ui/windows/AssetPacks.cpp b/src/openrct2-ui/windows/AssetPacks.cpp index 1f1b894e43..035a983bf8 100644 --- a/src/openrct2-ui/windows/AssetPacks.cpp +++ b/src/openrct2-ui/windows/AssetPacks.cpp @@ -41,15 +41,15 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget WindowAssetPacksWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto WindowAssetPacksWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_HIGH_PRIORITY), MakeWidget({ 0, 0 }, { 0, 147 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_LOW_PRIORITY), MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_ARROW_UP), STR_INCREASE_PRIOTITY_TIP), MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_ARROW_DOWN), STR_DECREASE_PRIOTITY_TIP), - MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_RELOAD), STR_RELOAD_ASSET_PACKS_TIP), - }; + MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_RELOAD), STR_RELOAD_ASSET_PACKS_TIP) + ); // clang-format on class AssetPacksWindow final : public Window diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index ac231ee077..003878cc69 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -65,16 +65,16 @@ namespace OpenRCT2::Ui::Windows STR_TEXT_COLOUR_PALESILVER, // TextColour::paleSilver }; - static constexpr Widget window_banner_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_banner_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 3, 17}, {85, 60}, WindowWidgetType::Viewport, WindowColour::Secondary, 0x0FFFFFFFE ), // tab content panel MakeWidget({WW - 25, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_CHANGE_BANNER_TEXT_TIP ), // change banner button MakeWidget({WW - 25, 43}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_NO_ENTRY), STR_SET_AS_NO_ENTRY_BANNER_TIP ), // no entry button MakeWidget({WW - 25, 67}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_DEMOLISH_BANNER_TIP ), // demolish button MakeWidget({ 5, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_MAIN_SIGN_COLOUR_TIP), // high money MakeWidget({ 43, WH - 16}, {39, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // high money - MakeWidget({ 70, WH - 15}, {11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_TEXT_COLOUR_TIP ), // high money - }; + MakeWidget({ 70, WH - 15}, {11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_TEXT_COLOUR_TIP ) // high money + ); // clang-format on class BannerWindow final : public Window diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 3a6680053f..805d90861d 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -42,12 +42,12 @@ namespace OpenRCT2::Ui::Windows constexpr int32_t MIN_WH = 250; // clang-format off - static Widget _windowChangelogWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _windowChangelogWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({0, 14}, {500, 382}, WindowWidgetType::Resize, WindowColour::Secondary ), // content panel MakeWidget({3, 16}, {495, 366}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), // scroll area - MakeWidget({3, 473}, {300, 14}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NEW_RELEASE_DOWNLOAD_PAGE), // changelog button - }; + MakeWidget({3, 473}, {300, 14}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NEW_RELEASE_DOWNLOAD_PAGE) // changelog button + ); // clang-format on class ChangelogWindow final : public Window diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index db41222f78..a02f92a34e 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -209,42 +209,40 @@ static constexpr int32_t kTabStart = 3; #pragma endregion -#define MAIN_CHEATS_WIDGETS \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, 43}, {WW, 257}, WindowWidgetType::Resize, WindowColour::Secondary), /* tab content panel */ \ - MakeTab ({ 3, 17}, STR_FINANCIAL_CHEATS_TIP ), /* tab 1 */ \ - MakeTab ({ 34, 17}, STR_DATE_CHEATS_TIP ), /* tab 2 */ \ - MakeTab ({ 65, 17}, STR_GUEST_CHEATS_TIP ), /* tab 3 */ \ - MakeTab ({ 96, 17}, STR_STAFF_CHEATS_TIP ), /* tab 5 */ \ - MakeTab ({127, 17}, STR_PARK_CHEATS_TIP ), /* tab 6 */ \ - MakeTab ({158, 17}, STR_RIDE_CHEATS_TIP ), /* tab 4 */ \ +static constexpr auto kMainCheatWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), + MakeWidget({ 0, 43}, {WW, 257}, WindowWidgetType::Resize, WindowColour::Secondary), /* tab content panel */ + MakeTab ({ 3, 17}, STR_FINANCIAL_CHEATS_TIP ), /* tab 1 */ + MakeTab ({ 34, 17}, STR_DATE_CHEATS_TIP ), /* tab 2 */ + MakeTab ({ 65, 17}, STR_GUEST_CHEATS_TIP ), /* tab 3 */ + MakeTab ({ 96, 17}, STR_STAFF_CHEATS_TIP ), /* tab 5 */ + MakeTab ({127, 17}, STR_PARK_CHEATS_TIP ), /* tab 6 */ + MakeTab ({158, 17}, STR_RIDE_CHEATS_TIP ), /* tab 4 */ MakeTab ({189, 17}, STR_WEATHER_NATURE_CHEATS_TIP ) /* tab 7 */ +); -static constexpr Widget window_cheats_money_widgets[] = -{ - MAIN_CHEATS_WIDGETS, +static constexpr auto window_cheats_money_widgets = makeWidgets( + kMainCheatWidgets, MakeWidget ({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAKE_PARK_NO_MONEY), // No money MakeWidget ({ 5, 69}, {238, 69}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_ADD_SET_MONEY ), // add / set money group frame MakeSpinnerWidgets({ 11, 92}, CHEAT_SPINNER, WindowWidgetType::Spinner, WindowColour::Secondary ), // money value MakeWidget ({ 11, 111}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_ADD_MONEY ), // add money MakeWidget ({127, 111}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_SET_MONEY ), // set money - MakeWidget ({ 11, 145}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_CLEAR_LOAN ), // Clear loan -}; + MakeWidget ({ 11, 145}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_CLEAR_LOAN ) // Clear loan +); -static constexpr Widget window_cheats_date_widgets[] = -{ - MAIN_CHEATS_WIDGETS, +static constexpr auto window_cheats_date_widgets = makeWidgets( + kMainCheatWidgets, MakeWidget ({ 5, 48}, {238, 99} , WindowWidgetType::Groupbox, WindowColour::Secondary, STR_DATE_SET ), // Date group MakeSpinnerWidgets({120, 61}, CHEAT_SPINNER, WindowWidgetType::Spinner, WindowColour::Secondary ), // Year box MakeSpinnerWidgets({120, 82}, CHEAT_SPINNER, WindowWidgetType::Spinner, WindowColour::Secondary ), // Month box MakeSpinnerWidgets({120, 103}, CHEAT_SPINNER, WindowWidgetType::Spinner, WindowColour::Secondary ), // Day box MakeWidget ({ 11, 122}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_SET ), // Set Date - MakeWidget ({127, 122}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_RESET), // Reset Date -}; + MakeWidget ({127, 122}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_RESET) // Reset Date +); -static constexpr Widget window_cheats_guests_widgets[] = -{ - MAIN_CHEATS_WIDGETS, +static constexpr auto window_cheats_guests_widgets = makeWidgets( + kMainCheatWidgets, MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_LARGE_TRAM_GUESTS, STR_CHEAT_LARGE_TRAM_GUESTS_TIP), // large tram MakeWidget({127, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_REMOVE_ALL_GUESTS, STR_CHEAT_REMOVE_ALL_GUESTS_TIP), // remove all guests @@ -276,12 +274,11 @@ static constexpr Widget window_cheats_guests_widgets[] = MakeWidget({ 11, 363+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_INTENSITY, STR_CHEAT_IGNORE_INTENSITY_TIP ), // guests ignore intensity MakeWidget({ 11, 380+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_PRICE, STR_CHEAT_IGNORE_PRICE_TIP ), // guests ignore price MakeWidget({ 11, 397+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_VANDALISM, STR_CHEAT_DISABLE_VANDALISM_TIP), // disable vandalism - MakeWidget({ 11, 414+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_LITTERING, STR_CHEAT_DISABLE_LITTERING_TIP), // disable littering -}; + MakeWidget({ 11, 414+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_LITTERING, STR_CHEAT_DISABLE_LITTERING_TIP) // disable littering +); -static constexpr Widget window_cheats_staff_widgets[] = -{ - MAIN_CHEATS_WIDGETS, +static constexpr auto window_cheats_staff_widgets = makeWidgets( + kMainCheatWidgets, MakeWidget ({ 5, 357-309}, {238, 35}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_STAFF_GROUP ), // Staff group MakeWidget ({126, 371-309}, {111, 14}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Staff speed MakeWidget ({225, 372-309}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), // Staff speed @@ -292,12 +289,11 @@ static constexpr Widget window_cheats_staff_widgets[] = MakeWidget ({ 11, 292-168}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_CLEAR_GRASS ), // Clear grass MakeWidget ({127, 292-168}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_MOWED_GRASS ), // Mowed grass MakeWidget ({ 11, 313-168}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_WATER_PLANTS ), // Water plants - MakeWidget ({ 11, 334-164}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_PLANT_AGING, STR_CHEAT_DISABLE_PLANT_AGING_TIP ), // Disable plant ageing -}; + MakeWidget ({ 11, 334-164}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_PLANT_AGING, STR_CHEAT_DISABLE_PLANT_AGING_TIP ) // Disable plant ageing +); -static constexpr Widget window_cheats_park_widgets[] = -{ - MAIN_CHEATS_WIDGETS, +static constexpr auto window_cheats_park_widgets = makeWidgets( + kMainCheatWidgets, MakeWidget ({ 5, 48}, {238, 60}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GENERAL_GROUP ), // General group MakeWidget ({ 11, 62}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_OWN_ALL_LAND, STR_CHEAT_OWN_ALL_LAND_TIP ), // Own all land MakeWidget ({127, 62}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_REMOVE_PARK_FENCES, STR_CHEAT_REMOVE_PARK_FENCES_TIP ), // Remove park fences @@ -313,12 +309,11 @@ static constexpr Widget window_cheats_park_widgets[] = MakeWidget ({ 5, 192}, {238, 68}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GROUP_CONSTRUCTION ), // Construction group MakeWidget ({ 11, 207}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_BUILD_IN_PAUSE_MODE, STR_CHEAT_BUILD_IN_PAUSE_MODE_TIP ), // Build in pause mode MakeWidget ({ 11, 224}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_PATH_AS_QUEUE, STR_CHEAT_ALLOW_PATH_AS_QUEUE_TIP ), // Allow regular footpaths as queue path - MakeWidget ({ 11, 241}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES_TIP), // Allow special colours in dropdown -}; + MakeWidget ({ 11, 241}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES_TIP) // Allow special colours in dropdown +); -static constexpr Widget window_cheats_rides_widgets[] = -{ - MAIN_CHEATS_WIDGETS, +static constexpr auto window_cheats_rides_widgets = makeWidgets( + kMainCheatWidgets, MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_FIX_ALL_RIDES, STR_CHEAT_FIX_ALL_RIDES_TIP ), // Fix all rides MakeWidget({127, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_RENEW_RIDES, STR_CHEAT_RENEW_RIDES_TIP ), // Renew rides MakeWidget({127, 69}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_RESET_CRASH_STATUS, STR_CHEAT_RESET_CRASH_STATUS_TIP ), // Reset crash status @@ -341,20 +336,19 @@ static constexpr Widget window_cheats_rides_widgets[] = MakeWidget({ 11, 308}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_ARBITRARY_RIDE_TYPE_CHANGES, STR_CHEAT_ALLOW_ARBITRARY_RIDE_TYPE_CHANGES_TIP), // Allow arbitrary ride type changes MakeWidget({ 11, 325}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES ), // Show vehicles from other track types MakeWidget({ 11, 342}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_TRAIN_LENGTH_LIMIT, STR_CHEAT_DISABLE_TRAIN_LENGTH_LIMIT_TIP ), // Disable train length limits - MakeWidget({ 11, 359}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_RESEARCH_STATUS, STR_CHEAT_IGNORE_RESEARCH_STATUS_TIP ), // Ignore Research Status -}; + MakeWidget({ 11, 359}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_RESEARCH_STATUS, STR_CHEAT_IGNORE_RESEARCH_STATUS_TIP ) // Ignore Research Status +); -static constexpr Widget window_cheats_weather_widgets[] = -{ - MAIN_CHEATS_WIDGETS, +static constexpr auto window_cheats_weather_widgets = makeWidgets( + kMainCheatWidgets, MakeWidget ({ 5, 48}, {238, 50}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_WEATHER_GROUP ), // Weather group MakeWidget ({126, 62}, {111, 14}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather MakeWidget ({225, 63}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather MakeWidget ({ 11, 80}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_FREEZE_WEATHER, STR_CHEAT_FREEZE_WEATHER_TIP), // Freeze weather MakeWidget ({ 5, 102}, {238, 37}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_FAUNA ), // Fauna group MakeWidget ({ 11, 115}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CREATE_DUCKS, STR_CREATE_DUCKS_TIP ), // Create ducks - MakeWidget ({127, 115}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_REMOVE_DUCKS, STR_REMOVE_DUCKS_TIP ), // Remove ducks -}; + MakeWidget ({127, 115}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_REMOVE_DUCKS, STR_REMOVE_DUCKS_TIP ) // Remove ducks +); static constexpr std::span window_cheats_page_widgets[] = { diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 18de4a206b..dded24afdc 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -43,27 +43,17 @@ namespace OpenRCT2::Ui::Windows static constexpr ScreenSize CLEAR_SCENERY_BUTTON = { 24, 24 }; - static constexpr Widget window_clear_scenery_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), - MakeWidget( - { 27, 17 }, { 44, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary, SPR_LAND_TOOL_SIZE_0, - kStringIdNone), // preview box - MakeRemapWidget( - { 28, 18 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE, - STR_ADJUST_SMALLER_LAND_TIP), // decrement size - MakeRemapWidget( - { 54, 32 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, - STR_ADJUST_LARGER_LAND_TIP), // increment size - MakeRemapWidget( - { 7, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_TREES, - STR_CLEAR_SCENERY_REMOVE_SMALL_SCENERY_TIP), // small scenery - MakeRemapWidget( - { 37, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_LARGE_SCENERY, - STR_CLEAR_SCENERY_REMOVE_LARGE_SCENERY_TIP), // large scenery - MakeRemapWidget( - { 67, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_FOOTPATH, - STR_CLEAR_SCENERY_REMOVE_FOOTPATHS_TIP), // footpaths - }; + // clang-format off + static constexpr auto window_clear_scenery_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), + MakeWidget ({ 27, 17 }, { 44, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary, SPR_LAND_TOOL_SIZE_0, kStringIdNone ), // preview box + MakeRemapWidget({ 28, 18 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_LAND_TIP ), // decrement size + MakeRemapWidget({ 54, 32 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_TIP ), // increment size + MakeRemapWidget({ 7, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_TREES, STR_CLEAR_SCENERY_REMOVE_SMALL_SCENERY_TIP), // small scenery + MakeRemapWidget({ 37, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_LARGE_SCENERY, STR_CLEAR_SCENERY_REMOVE_LARGE_SCENERY_TIP), // large scenery + MakeRemapWidget({ 67, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_FOOTPATH, STR_CLEAR_SCENERY_REMOVE_FOOTPATHS_TIP ) // footpaths + ); + // clang-format on class CleanSceneryWindow final : public Window { diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 32b66a0101..4e8a5167f6 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -40,13 +40,13 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static Widget window_custom_currency_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_custom_currency_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeSpinnerWidgets({100, 30}, {101, 11}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_CURRENCY_FORMAT), // NB: 3 widgets MakeWidget ({120, 50}, { 81, 11}, WindowWidgetType::Button, WindowColour::Secondary, kStringIdEmpty ), MakeWidget ({220, 50}, {131, 11}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), - MakeWidget ({339, 51}, { 11, 9}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), - }; + MakeWidget ({339, 51}, { 11, 9}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ) + ); // clang-format on class CustomCurrencyWindow final : public Window diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 966c9f8aa9..422b694a91 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -33,12 +33,11 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_ride_demolish_widgets[] = - { - WINDOW_SHIM(STR_DEMOLISH_RIDE, WW, WH), + static constexpr auto window_ride_demolish_widgets = makeWidgets( + makeWindowShim(STR_DEMOLISH_RIDE, WW, WH), MakeWidget({ 10, WH - 22}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_DEMOLISH ), - MakeWidget({WW - 95, WH - 22}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL), - }; + MakeWidget({WW - 95, WH - 22}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL) + ); // clang-format on class DemolishRidePromptWindow final : public Window diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index e7821f5546..4247a8178b 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -52,8 +52,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _inventionListWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _inventionListWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {600, 357}, WindowWidgetType::Resize, WindowColour::Secondary ), MakeTab ({ 3, 17} ), MakeWidget({ 4, 56}, {368, 161}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), @@ -61,12 +61,12 @@ namespace OpenRCT2::Ui::Windows MakeWidget({431, 106}, {114, 114}, WindowWidgetType::FlatBtn, WindowColour::Secondary ), MakeWidget({375, 343}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MOVE_ALL_TOP ), MakeWidget({375, 358}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MOVE_ALL_BOTTOM ), - MakeWidget({375, 373}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RANDOM_SHUFFLE, STR_RANDOM_SHUFFLE_TIP), - }; + MakeWidget({375, 373}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RANDOM_SHUFFLE, STR_RANDOM_SHUFFLE_TIP) + ); - static constexpr Widget _inventionListDragWidgets[] = { - MakeWidget({0, 0}, {150, 14}, WindowWidgetType::ImgBtn, WindowColour::Primary), - }; + static constexpr auto _inventionListDragWidgets = makeWidgets( + MakeWidget({0, 0}, {150, 14}, WindowWidgetType::ImgBtn, WindowColour::Primary) + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 964ab20d22..4c7f65be98 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -217,8 +217,8 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_EDITOR_OBJECT_SELECTION, WIDX_TAB_1); // clang-format off - static constexpr Widget _window_editor_object_selection_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _window_editor_object_selection_widgets = makeWidgets( + makeWindowShim (WINDOW_TITLE, WW, WH), MakeWidget ({ 0, 43}, {WW, 357}, WindowWidgetType::Resize, WindowColour::Secondary ), MakeWidget ({ 4, 60}, {288, 277}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), MakeWidget ({391, 45}, {114, 114}, WindowWidgetType::FlatBtn, WindowColour::Secondary ), @@ -237,9 +237,9 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 4, 80}, {145, 14}, WindowWidgetType::TableHeader, WindowColour::Secondary ), MakeWidget ({149, 80}, {143, 14}, WindowWidgetType::TableHeader, WindowColour::Secondary ), MakeWidget ({700, 50}, { 24, 24}, WindowWidgetType::ImgBtn, WindowColour::Secondary, SPR_G2_RELOAD, STR_RELOAD_OBJECT_TIP ), - MakeTab ({ 3, 17}, STR_STRING_DEFINED_TOOLTIP ), + MakeTab ({ 3, 17}, STR_STRING_DEFINED_TOOLTIP ) // Copied object type times... - }; + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index 06d3882ed8..291a5a775e 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -58,13 +58,13 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_EDITOR_PARK_ENTRANCE, WIDX_ROTATE_ENTRANCE_BUTTON); // clang-format off - static Widget _widgets[] = { - WINDOW_SHIM(kWindowTitle, kWindowWidth, kWindowHeight), + static constexpr auto _widgets = makeWidgets( + makeWindowShim(kWindowTitle, kWindowWidth, kWindowHeight), MakeWidget ({ 0, 43 }, { kWindowWidth, kWindowHeight - 43 }, WindowWidgetType::Resize, WindowColour::Secondary ), MakeTab ({ 3, 17 }, kStringIdNone ), MakeWidget ({ 2, 45 }, { kScrollWidth, kScrollHeight }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), - MakeWidget ({ kWindowWidth - 26, 59 }, { 24, 24 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_OBJECTS_90 ), - }; + MakeWidget ({ kWindowWidth - 26, 59 }, { 24, 24 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_OBJECTS_90 ) + ); // clang-format on class EditorParkEntrance final : public Window diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index afa3c49aae..2af9daa8a6 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -196,36 +196,39 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - #define MAIN_OPTIONS_WIDGETS(TITLE, WIDTH, HEIGHT) \ - WINDOW_SHIM(TITLE, WIDTH, HEIGHT), \ - MakeWidget({ 0, 43}, { WIDTH, 106 }, WindowWidgetType::Resize, WindowColour::Secondary), \ - MakeTab ({ 3, 17}, STR_SCENARIO_OPTIONS_OBJECTIVE_TIP ), \ - MakeTab ({ 34, 17}, STR_SCENARIO_OPTIONS_SCENARIO_DETAILS_TIP ), \ - MakeTab ({ 65, 17}, STR_SCENARIO_OPTIONS_FINANCIAL_TIP ), \ - MakeTab ({ 96, 17}, STR_SCENARIO_OPTIONS_GUESTS_TIP ), \ - MakeTab ({127, 17}, STR_SCENARIO_OPTIONS_LAND_RESTRICTIONS_TIP ), \ - MakeTab ({158, 17}, STR_SCENARIO_OPTIONS_PRESERVED_RIDES_TIP ) + static constexpr auto makeOptionsWidgets = [](StringId title, ScreenSize size) { + return makeWidgets( + makeWindowShim(title, size.width, size.height), + MakeWidget({ 0, 43}, { size.width, 106 }, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab ({ 3, 17}, STR_SCENARIO_OPTIONS_OBJECTIVE_TIP ), + MakeTab ({ 34, 17}, STR_SCENARIO_OPTIONS_SCENARIO_DETAILS_TIP ), + MakeTab ({ 65, 17}, STR_SCENARIO_OPTIONS_FINANCIAL_TIP ), + MakeTab ({ 96, 17}, STR_SCENARIO_OPTIONS_GUESTS_TIP ), + MakeTab ({127, 17}, STR_SCENARIO_OPTIONS_LAND_RESTRICTIONS_TIP ), + MakeTab ({158, 17}, STR_SCENARIO_OPTIONS_PRESERVED_RIDES_TIP ) + ); + }; - static constexpr Widget window_editor_scenario_options_objective_widgets[] = { - MAIN_OPTIONS_WIDGETS(STR_SCENARIO_OPTIONS_OBJECTIVE, kSizeObjective.width, kSizeObjective.height), + static constexpr auto window_editor_scenario_options_objective_widgets = makeWidgets( + makeOptionsWidgets(STR_SCENARIO_OPTIONS_OBJECTIVE, kSizeObjective), MakeWidget ({ 98, 48}, {344, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_SELECT_OBJECTIVE_FOR_THIS_SCENARIO_TIP ), MakeWidget ({430, 49}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_OBJECTIVE_FOR_THIS_SCENARIO_TIP ), MakeSpinnerWidgets({158, 65}, {120, 12}, WindowWidgetType::Button, WindowColour::Secondary ), // NB: 3 widgets MakeSpinnerWidgets({158, 82}, {120, 12}, WindowWidgetType::Button, WindowColour::Secondary ), // NB: 3 widgets - MakeWidget ({ 14, 99}, {340, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_PARK_RATING, STR_HARD_PARK_RATING_TIP ), - }; + MakeWidget ({ 14, 99}, {340, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_PARK_RATING, STR_HARD_PARK_RATING_TIP ) + ); - static constexpr Widget window_editor_scenario_options_scenario_details_widgets[] = { - MAIN_OPTIONS_WIDGETS(STR_SCENARIO_OPTIONS_SCENARIO_DETAILS, kSizeScenarioDetails.width, kSizeScenarioDetails.height), + static constexpr auto window_editor_scenario_options_scenario_details_widgets = makeWidgets( + makeOptionsWidgets(STR_SCENARIO_OPTIONS_SCENARIO_DETAILS, kSizeScenarioDetails), MakeWidget ({370, 48}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_NAME_OF_PARK_TIP ), MakeWidget ({370, 65}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_NAME_OF_SCENARIO_TIP ), MakeWidget ({ 98, 82}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN), MakeWidget ({266, 83}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN), - MakeWidget ({370, 99}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_DETAIL_NOTES_ABOUT_PARK_SCENARIO_TIP), - }; + MakeWidget ({370, 99}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_DETAIL_NOTES_ABOUT_PARK_SCENARIO_TIP) + ); - static constexpr Widget window_editor_scenario_options_financial_widgets[] = { - MAIN_OPTIONS_WIDGETS(STR_SCENARIO_OPTIONS_FINANCIAL, kSizeFinancial.width, kSizeFinancial.height), + static constexpr auto window_editor_scenario_options_financial_widgets = makeWidgets( + makeOptionsWidgets(STR_SCENARIO_OPTIONS_FINANCIAL, kSizeFinancial), MakeWidget ({ 8, 48}, {kSizeFinancial.width - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAKE_PARK_NO_MONEY, STR_MAKE_PARK_NO_MONEY_TIP ), MakeWidget ({ 5, 63}, {kSizeFinancial.width - 10, 67}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_GROUP_LOAN_OPTIONS ), MakeWidget ({ 9, 77}, { 250, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_INIT_LOAN_LABEL ), @@ -243,11 +246,11 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({356, 168}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_PAY_FOR_PARK_PAY_FOR_RIDES_TIP), MakeWidget ({ 9, 184}, { 280, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_ENTRY_PRICE_LABEL ), MakeSpinnerWidgets({298, 184}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets - MakeWidget ({ 10, 201}, {kSizeFinancial.width - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_MARKETING, STR_FORBID_MARKETING_TIP ), - }; + MakeWidget ({ 10, 201}, {kSizeFinancial.width - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_MARKETING, STR_FORBID_MARKETING_TIP ) + ); - static constexpr Widget window_editor_scenario_options_guests_widgets[] = { - MAIN_OPTIONS_WIDGETS(STR_SCENARIO_OPTIONS_GUESTS, kSizeGuests.width, kSizeGuests.height), + static constexpr auto window_editor_scenario_options_guests_widgets = makeWidgets( + makeOptionsWidgets(STR_SCENARIO_OPTIONS_GUESTS, kSizeGuests), MakeWidget ({ 8, 48}, { 280, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_CASH_PER_GUEST_LABEL ), MakeSpinnerWidgets({298, 48}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets MakeWidget ({ 8, 65}, { 280, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_INIT_HAPPINESS ), @@ -259,25 +262,25 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 8, 116}, { 180, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_GUESTS_PREFER_INTENSITY_LABEL ), MakeWidget ({198, 116}, { 170, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_GUESTS_PREFER_INTENSITY_TIP ), MakeWidget ({357, 117}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_GUESTS_PREFER_INTENSITY_TIP ), - MakeWidget ({ 8, 133}, { 350, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_GUEST_GENERATION, STR_HARD_GUEST_GENERATION_TIP ), - }; + MakeWidget ({ 8, 133}, { 350, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_GUEST_GENERATION, STR_HARD_GUEST_GENERATION_TIP ) + ); - static constexpr Widget window_editor_scenario_options_land_widgets[] = { - MAIN_OPTIONS_WIDGETS(STR_SCENARIO_OPTIONS_LAND_RESTRICTIONS, kSizeLand.width, kSizeLand.height), + static constexpr auto window_editor_scenario_options_land_widgets = makeWidgets( + makeOptionsWidgets(STR_SCENARIO_OPTIONS_LAND_RESTRICTIONS, kSizeLand), MakeWidget ({ 8, 48}, { 170, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_LAND_COST_LABEL ), MakeSpinnerWidgets({188, 48}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets MakeWidget ({ 8, 65}, { 170, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_RIGHTS_COST_LABEL ), MakeSpinnerWidgets({188, 65}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets MakeWidget ({ 8, 82}, {kSizeLand.width - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_TREE_REMOVAL, STR_FORBID_TREE_REMOVAL_TIP ), MakeWidget ({ 8, 99}, {kSizeLand.width - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_LANDSCAPE_CHANGES, STR_FORBID_LANDSCAPE_CHANGES_TIP ), - MakeWidget ({ 8, 116}, {kSizeLand.width - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_HIGH_CONSTRUCTION, STR_FORBID_HIGH_CONSTRUCTION_TIP ), - }; + MakeWidget ({ 8, 116}, {kSizeLand.width - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_HIGH_CONSTRUCTION, STR_FORBID_HIGH_CONSTRUCTION_TIP ) + ); - static constexpr Widget window_editor_scenario_options_rides_widgets[] = { - MAIN_OPTIONS_WIDGETS(STR_SCENARIO_OPTIONS_PRESERVED_RIDES, kSizeRides.width, kSizeRides.height), + static constexpr auto window_editor_scenario_options_rides_widgets = makeWidgets( + makeOptionsWidgets(STR_SCENARIO_OPTIONS_PRESERVED_RIDES, kSizeRides), MakeWidget({ 6, 46}, {kSizeRides.width - 12, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_WINDOW_PRESERVATION_ORDER), - MakeWidget({ 3, 60}, { 374, 161}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), - }; + MakeWidget({ 3, 60}, { 374, 161}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ) + ); static constexpr std::span window_editor_scenario_options_widgets[] = { window_editor_scenario_options_objective_widgets, diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 58447621c9..43ce9ffefa 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -98,41 +98,39 @@ namespace OpenRCT2::Ui::Windows // clang-format off #pragma region Widgets -#define MAIN_FINANCES_WIDGETS(TITLE, RSW, RSH, WW, WH) \ - WINDOW_SHIM(TITLE, WW, WH), \ - MakeWidget({ 0, 43 }, { RSW, RSH }, WindowWidgetType::Resize, WindowColour::Secondary), \ - MakeTab({ 3, 17 }, STR_FINANCES_SHOW_SUMMARY_TAB_TIP), \ - MakeTab({ 34, 17 }, STR_FINANCES_SHOW_CASH_TAB_TIP), \ - MakeTab({ 65, 17 }, STR_FINANCES_SHOW_PARK_VALUE_TAB_TIP), \ - MakeTab({ 96, 17 }, STR_FINANCES_SHOW_WEEKLY_PROFIT_TAB_TIP), \ - MakeTab({ 127, 17 }, STR_FINANCES_SHOW_MARKETING_TAB_TIP), \ - MakeTab({ 158, 17 }, STR_FINANCES_RESEARCH_TIP) + static constexpr auto makeFinancesWidgets = [](StringId title, ScreenSize resizeSize, ScreenSize frameSize) { + return makeWidgets( + makeWindowShim(title, frameSize.width, frameSize.height), + MakeWidget({ 0, 43 }, resizeSize, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab({ 3, 17 }, STR_FINANCES_SHOW_SUMMARY_TAB_TIP), + MakeTab({ 34, 17 }, STR_FINANCES_SHOW_CASH_TAB_TIP), + MakeTab({ 65, 17 }, STR_FINANCES_SHOW_PARK_VALUE_TAB_TIP), + MakeTab({ 96, 17 }, STR_FINANCES_SHOW_WEEKLY_PROFIT_TAB_TIP), + MakeTab({ 127, 17 }, STR_FINANCES_SHOW_MARKETING_TAB_TIP), + MakeTab({ 158, 17 }, STR_FINANCES_RESEARCH_TIP) + ); + }; - static constexpr Widget _windowFinancesSummaryWidgets[] = - { - MAIN_FINANCES_WIDGETS(STR_FINANCIAL_SUMMARY, RSW_OTHER_TABS, RSH_SUMMARY, WW_OTHER_TABS, kHeightSummary), + static constexpr auto _windowFinancesSummaryWidgets = makeWidgets( + makeFinancesWidgets(STR_FINANCIAL_SUMMARY,{ RSW_OTHER_TABS, RSH_SUMMARY }, { WW_OTHER_TABS, kHeightSummary }), MakeWidget ({130, 50}, {391, 211}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), - MakeSpinnerWidgets({ 64, 279}, { 97, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_FINANCES_SUMMARY_LOAN_VALUE), // NB: 3 widgets. - }; + MakeSpinnerWidgets({ 64, 279}, { 97, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_FINANCES_SUMMARY_LOAN_VALUE) // NB: 3 widgets + ); - static constexpr Widget _windowFinancesCashWidgets[] = - { - MAIN_FINANCES_WIDGETS(STR_FINANCIAL_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, kHeightOtherTabs), - }; + static constexpr auto _windowFinancesCashWidgets = makeWidgets( + makeFinancesWidgets(STR_FINANCIAL_GRAPH, { RSW_OTHER_TABS, RSH_OTHER_TABS }, { WW_OTHER_TABS, kHeightOtherTabs }) + ); - static constexpr Widget _windowFinancesParkValueWidgets[] = - { - MAIN_FINANCES_WIDGETS(STR_PARK_VALUE_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, kHeightOtherTabs), - }; + static constexpr auto _windowFinancesParkValueWidgets = makeWidgets( + makeFinancesWidgets(STR_PARK_VALUE_GRAPH, { RSW_OTHER_TABS, RSH_OTHER_TABS }, { WW_OTHER_TABS, kHeightOtherTabs }) + ); - static constexpr Widget _windowFinancesProfitWidgets[] = - { - MAIN_FINANCES_WIDGETS(STR_PROFIT_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, kHeightOtherTabs), - }; + static constexpr auto _windowFinancesProfitWidgets = makeWidgets( + makeFinancesWidgets(STR_PROFIT_GRAPH, { RSW_OTHER_TABS, RSH_OTHER_TABS }, { WW_OTHER_TABS, kHeightOtherTabs }) + ); - static constexpr Widget _windowFinancesMarketingWidgets[] = - { - MAIN_FINANCES_WIDGETS(STR_MARKETING, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, kHeightOtherTabs), + static constexpr auto _windowFinancesMarketingWidgets = makeWidgets( + makeFinancesWidgets(STR_MARKETING, { RSW_OTHER_TABS, RSH_OTHER_TABS }, { WW_OTHER_TABS, kHeightOtherTabs }), MakeWidget({3, 47}, { WW_OTHER_TABS - 6, 45}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_MARKETING_CAMPAIGNS_IN_OPERATION ), MakeWidget({3, 47}, { WW_OTHER_TABS - 6, 206}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_MARKETING_CAMPAIGNS_AVAILABLE ), MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), @@ -140,12 +138,11 @@ namespace OpenRCT2::Ui::Windows MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), - MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN), - }; + MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN) + ); - static constexpr Widget _windowFinancesResearchWidgets[] = - { - MAIN_FINANCES_WIDGETS(STR_RESEARCH_FUNDING, RSW_RESEARCH, RSH_RESEARCH, WW_RESEARCH, kHeightResearch), + static constexpr auto _windowFinancesResearchWidgets = makeWidgets( + makeFinancesWidgets(STR_RESEARCH_FUNDING, { RSW_RESEARCH, RSH_RESEARCH }, { WW_RESEARCH, kHeightResearch }), MakeWidget({ 3, 47}, { WW_RESEARCH - 6, 45}, WindowWidgetType::Groupbox, WindowColour::Tertiary, STR_RESEARCH_FUNDING_ ), MakeWidget({ 8, 59}, { 160, 14}, WindowWidgetType::DropdownMenu, WindowColour::Tertiary, 0xFFFFFFFF, STR_SELECT_LEVEL_OF_RESEARCH_AND_DEVELOPMENT), MakeWidget({156, 60}, { 11, 12}, WindowWidgetType::Button, WindowColour::Tertiary, STR_DROPDOWN_GLYPH, STR_SELECT_LEVEL_OF_RESEARCH_AND_DEVELOPMENT), @@ -156,8 +153,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 8, 147}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_THRILL_RIDES, STR_RESEARCH_NEW_THRILL_RIDES_TIP ), MakeWidget({ 8, 160}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_WATER_RIDES, STR_RESEARCH_NEW_WATER_RIDES_TIP ), MakeWidget({ 8, 173}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_SHOPS_AND_STALLS, STR_RESEARCH_NEW_SHOPS_AND_STALLS_TIP ), - MakeWidget({ 8, 186}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ), - }; + MakeWidget({ 8, 186}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ) + ); // clang-format on static constexpr std::span _windowFinancesPageWidgets[] = { diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 5856c8e550..abaf828d83 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -123,8 +123,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_footpath_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW_WINDOW, WH_WINDOW), + static constexpr auto window_footpath_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW_WINDOW, WH_WINDOW), // Type group MakeWidget({ 3, 17}, {100, 95}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_TYPE ), @@ -150,8 +150,8 @@ namespace OpenRCT2::Ui::Windows // Mode group MakeWidget({ 3, 361}, {100, 54}, WindowWidgetType::Groupbox, WindowColour::Primary ), MakeWidget({13, 372}, { 36, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION_FOOTPATH_LAND), STR_CONSTRUCT_FOOTPATH_ON_LAND_TIP ), - MakeWidget({57, 372}, { 36, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION_FOOTPATH_BRIDGE), STR_CONSTRUCT_BRIDGE_OR_TUNNEL_FOOTPATH_TIP ), - }; + MakeWidget({57, 372}, { 36, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION_FOOTPATH_BRIDGE), STR_CONSTRUCT_BRIDGE_OR_TUNNEL_FOOTPATH_TIP ) + ); #pragma endregion diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 2670b7f517..f68b91e34f 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -111,31 +111,32 @@ namespace OpenRCT2::Ui::Windows static constexpr int32_t TabWidth = 30; -#define MAIN_GUEST_WIDGETS \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, 43 }, { 192, 114 }, WindowWidgetType::Resize, WindowColour::Secondary), /* Resize */ \ - MakeTab({ 3, 17 }, STR_SHOW_GUEST_VIEW_TIP), /* Tab 1 */ \ - MakeTab({ 34, 17 }, STR_SHOW_GUEST_NEEDS_TIP), /* Tab 2 */ \ - MakeTab({ 65, 17 }, STR_SHOW_GUEST_VISITED_RIDES_TIP), /* Tab 3 */ \ - MakeTab({ 96, 17 }, STR_SHOW_GUEST_FINANCE_TIP), /* Tab 4 */ \ - MakeTab({ 127, 17 }, STR_SHOW_GUEST_THOUGHTS_TIP), /* Tab 5 */ \ - MakeTab({ 158, 17 }, STR_SHOW_GUEST_ITEMS_TIP), /* Tab 6 */ \ - MakeTab({ 189, 17 }, STR_DEBUG_TIP) /* Tab 7 */ - // clang-format off - static constexpr Widget _guestWindowWidgetsOverview[] = { - MAIN_GUEST_WIDGETS, + static constexpr auto kMainGuestWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), \ + MakeWidget({ 0, 43 }, { 192, 114 }, WindowWidgetType::Resize, WindowColour::Secondary), /* Resize */ + MakeTab({ 3, 17 }, STR_SHOW_GUEST_VIEW_TIP), /* Tab 1 */ + MakeTab({ 34, 17 }, STR_SHOW_GUEST_NEEDS_TIP), /* Tab 2 */ + MakeTab({ 65, 17 }, STR_SHOW_GUEST_VISITED_RIDES_TIP), /* Tab 3 */ + MakeTab({ 96, 17 }, STR_SHOW_GUEST_FINANCE_TIP), /* Tab 4 */ + MakeTab({ 127, 17 }, STR_SHOW_GUEST_THOUGHTS_TIP), /* Tab 5 */ + MakeTab({ 158, 17 }, STR_SHOW_GUEST_ITEMS_TIP), /* Tab 6 */ + MakeTab({ 189, 17 }, STR_DEBUG_TIP) /* Tab 7 */ + ); + + static constexpr auto _guestWindowWidgetsOverview = makeWidgets( + kMainGuestWidgets, MakeWidget({ 3, 45}, {164, 12}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // Label Thought marquee MakeWidget({ 3, 57}, {164, 87}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport MakeWidget({ 3, 144}, {164, 11}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // Label Action MakeWidget({167, 45}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PICKUP_BTN), STR_PICKUP_TIP ), // Pickup Button MakeWidget({167, 69}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_GUEST_TIP ), // Rename Button MakeWidget({167, 93}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP ), // Locate Button - MakeWidget({167, 117}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_TRACK_PEEP), STR_TOGGLE_GUEST_TRACKING_TIP), // Track Button - }; + MakeWidget({167, 117}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_TRACK_PEEP), STR_TOGGLE_GUEST_TRACKING_TIP) // Track Button + ); - static constexpr Widget _guestWindowWidgetsStats[] = { - MAIN_GUEST_WIDGETS, + static constexpr auto _guestWindowWidgetsStats = makeWidgets( + kMainGuestWidgets, MakeWidget ({ 3, (kListRowHeight * 0) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_HAPPINESS_LABEL), MakeProgressBar({ 65, (kListRowHeight * 0) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_GREEN, 0, 19), MakeWidget ({ 3, (kListRowHeight * 1) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_ENERGY_LABEL), @@ -148,32 +149,32 @@ namespace OpenRCT2::Ui::Windows MakeProgressBar({ 65, (kListRowHeight * 4) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 47, 100), MakeWidget ({ 3, (kListRowHeight * 5) + 4 + 43 }, { 62, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_STAT_TOILET_LABEL), MakeProgressBar({ 65, (kListRowHeight * 5) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 62, 100), - MakeWidget ({ 3, (kListRowHeight * 7) + 9 + 43 }, { 180, 2 }, WindowWidgetType::HorizontalSeparator, WindowColour::Secondary), - }; + MakeWidget ({ 3, (kListRowHeight * 7) + 9 + 43 }, { 180, 2 }, WindowWidgetType::HorizontalSeparator, WindowColour::Secondary) + ); - static constexpr Widget _guestWindowWidgetsRides[] = { - MAIN_GUEST_WIDGETS, + static constexpr auto _guestWindowWidgetsRides = makeWidgets( + kMainGuestWidgets, MakeWidget({ 3, 45 }, { 186, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_LABEL_RIDES_BEEN_ON), - MakeWidget({ 3, 57 }, { 186, 87 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), - }; + MakeWidget({ 3, 57 }, { 186, 87 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL) + ); - static constexpr Widget _guestWindowWidgetsFinance[] = { - MAIN_GUEST_WIDGETS, - }; + static constexpr auto _guestWindowWidgetsFinance = makeWidgets( + kMainGuestWidgets + ); - static constexpr Widget _guestWindowWidgetsThoughts[] = { - MAIN_GUEST_WIDGETS, - MakeWidget({ 3, 45 }, { 186, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_RECENT_THOUGHTS_LABEL), - }; + static constexpr auto _guestWindowWidgetsThoughts = makeWidgets( + kMainGuestWidgets, + MakeWidget({ 3, 45 }, { 186, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_GUEST_RECENT_THOUGHTS_LABEL) + ); - static constexpr Widget _guestWindowWidgetsInventory[] = { - MAIN_GUEST_WIDGETS, - MakeWidget({ 3, 45 }, { 186, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_CARRYING), - }; + static constexpr auto _guestWindowWidgetsInventory = makeWidgets( + kMainGuestWidgets, + MakeWidget({ 3, 45 }, { 186, 10 }, WindowWidgetType::Label, WindowColour::Secondary, STR_CARRYING) + ); - static constexpr Widget _guestWindowWidgetsDebug[] = { - MAIN_GUEST_WIDGETS, - }; + static constexpr auto _guestWindowWidgetsDebug = makeWidgets( + kMainGuestWidgets + ); static constexpr std::span _guestWindowPageWidgets[] = { _guestWindowWidgetsOverview, diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index c4e73e3680..ca15b73d97 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -57,8 +57,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_guest_list_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_guest_list_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {350, 287}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel MakeWidget({ 5, 59}, { 80, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_4_PAGE_X ), // page dropdown MakeWidget({ 73, 60}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), // page dropdown button @@ -69,8 +69,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({321, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_TRACK_PEEP), STR_TRACKED_GUESTS_ONLY_TIP ), // tracking MakeTab ({ 3, 17}, STR_INDIVIDUAL_GUESTS_TIP ), // tab 1 MakeTab ({ 34, 17}, STR_SUMMARISED_GUESTS_TIP ), // tab 2 - MakeWidget({ 3, 72}, {344, 255}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), // guest list - }; + MakeWidget({ 3, 72}, {344, 255}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ) // guest list + ); // clang-format on class GuestListWindow final : public Window diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index dea22082cd..3d651d4254 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -51,14 +51,14 @@ namespace OpenRCT2::Ui::Windows constexpr int32_t ACTION_BUTTONS_LEFT = WW - 100; // clang-format off - static constexpr Widget window_install_track_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_install_track_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 4, 18}, {372, 219}, WindowWidgetType::FlatBtn, WindowColour::Primary ), MakeWidget({PREVIEW_BUTTONS_LEFT, 422}, { 22, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ), MakeWidget({PREVIEW_BUTTONS_LEFT, 398}, { 22, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_SCENERY), STR_TOGGLE_SCENERY_TIP), MakeWidget({ ACTION_BUTTONS_LEFT, 241}, { 97, 15}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN_INSTALL ), - MakeWidget({ ACTION_BUTTONS_LEFT, 259}, { 97, 15}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN_CANCEL ), - }; + MakeWidget({ ACTION_BUTTONS_LEFT, 259}, { 97, 15}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN_CANCEL ) + ); // clang-format on class InstallTrackWindow final : public Window diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 951f83660b..3e8702f13b 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -52,16 +52,16 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_land_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_land_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget ({19, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP), STR_ENABLE_MOUNTAIN_TOOL_TIP), // mountain mode MakeWidget ({55, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PAINTBRUSH), STR_DISABLE_ELEVATION), // paint mode MakeWidget ({27, 48}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0), kStringIdNone), // preview box MakeRemapWidget({28, 49}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_LAND_TIP), // decrement size MakeRemapWidget({54, 63}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_TIP), // increment size MakeWidget ({ 2, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_BASE_LAND_TIP), // floor texture - MakeWidget ({49, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP), // wall texture - }; + MakeWidget ({49, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP) // wall texture + ); // clang-format on class LandWindow final : public Window diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index c4ecb4dc15..eef15786b2 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -58,8 +58,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_land_rights_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_land_rights_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget ({ 27, 17}, { 44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary, ImageId(SPR_LAND_TOOL_SIZE_0) ), // preview box MakeRemapWidget({ 28, 18}, { 16, 16}, WindowWidgetType::TrnBtn, WindowColour::Primary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_LAND_RIGHTS_TIP ), // decrement size MakeRemapWidget({ 54, 32}, { 16, 16}, WindowWidgetType::TrnBtn, WindowColour::Primary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_RIGHTS_TIP ), // increment size @@ -69,8 +69,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({100, 38}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_LAND_SALE, STR_SET_LAND_TO_BE_AVAILABLE_TIP ), MakeWidget ({100, 54}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_CONSTRUCTION_RIGHTS_OWNED, STR_SET_CONSTRUCTION_RIGHTS_TO_BE_OWNED_TIP ), MakeWidget ({100, 70}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_CONSTRUCTION_RIGHTS_SALE, STR_SET_CONSTRUCTION_RIGHTS_TO_BE_AVAILABLE_TIP), - MakeWidget ({100, 86}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_LAND_NOT_OWNED, STR_SET_LAND_TO_BE_NOT_OWNED_TIP ), - }; + MakeWidget ({100, 86}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_LAND_NOT_OWNED, STR_SET_LAND_TO_BE_NOT_OWNED_TIP ) + ); // clang-format on enum class LandRightsMode : uint8_t diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 063460d4d2..c06196a740 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -100,9 +100,8 @@ namespace OpenRCT2::Ui::Windows static constexpr int16_t WH = kWindowSizeInit.height; // clang-format off - static constexpr Widget window_loadsave_widgets[] = - { - WINDOW_SHIM(kStringIdNone, WW, WH), + static constexpr auto window_loadsave_widgets = makeWidgets( + makeWindowShim(kStringIdNone, WW, WH), MakeWidget({ 0, 15 }, { WW, WH - 15 }, WindowWidgetType::Resize, WindowColour::Secondary ), // WIDX_RESIZE MakeWidget({ WW - 100 - 4, 20 }, { 20, 20 }, WindowWidgetType::FlatBtn, WindowColour::Primary, SPR_G2_FOLDER_PARENT, STR_PARENT_FOLDER_TIP ), // WIDX_PARENT_FOLDER MakeWidget({ WW - 50 - 4, 20 }, { 20, 20 }, WindowWidgetType::FlatBtn, WindowColour::Primary, SPR_G2_FOLDER_NEW, STR_FILEBROWSER_ACTION_NEW_FOLDER), // WIDX_NEW_FOLDER @@ -114,8 +113,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ (WW - 19), 45 }, { 14, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_DROPDOWN_GLYPH ), // WIDX_SORT_CUSTOMISE MakeWidget({ 4, 58 }, { 342, 303 }, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL ), // WIDX_SCROLL MakeWidget({ 64, WH - 50 }, { WW - 133, 14 }, WindowWidgetType::TextBox, WindowColour::Secondary ), // WIDX_FILENAME_TEXTBOX - MakeWidget({ WW - 65, WH - 50 }, { 60, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_FILEBROWSER_SAVE_BUTTON ), // WIDX_SAVE - }; + MakeWidget({ WW - 65, WH - 50 }, { 60, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_FILEBROWSER_SAVE_BUTTON ) // WIDX_SAVE + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index df55d03550..f8ba1f9481 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -131,8 +131,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_map_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_map_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget ({ 0, 43}, {245, 215}, WindowWidgetType::Resize, WindowColour::Secondary ), MakeRemapWidget ({ 3, 17}, { 31, 27}, WindowWidgetType::ColourBtn, WindowColour::Secondary, SPR_TAB, STR_SHOW_PEOPLE_ON_MAP_TIP ), MakeRemapWidget ({ 34, 17}, { 31, 27}, WindowWidgetType::ColourBtn, WindowColour::Secondary, SPR_TAB, STR_SHOW_RIDES_STALLS_ON_MAP_TIP), @@ -143,8 +143,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 4, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_BUY_LAND_RIGHTS), STR_SELECT_PARK_OWNED_LAND_TIP ), MakeWidget ({ 4, 70}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_PEEP_SPAWN), STR_SET_STARTING_POSITIONS_TIP ), MakeWidget ({ 28, 94}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PARK_ENTRANCE), STR_BUILD_PARK_ENTRANCE_TIP ), - MakeWidget ({110, 118}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_MAP_GEN_BTN), STR_MAP_GENERATOR_TIP ), - }; + MakeWidget ({110, 118}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_MAP_GEN_BTN), STR_MAP_GENERATOR_TIP ) + ); // clang-format on // These represent a coefficient for the map size to be multiplied diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index f4a2139eb2..a753a5ea7f 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -115,17 +115,20 @@ namespace OpenRCT2::Ui::Windows static constexpr ScreenSize kWindowSize = { 300, 220 }; // clang-format off -#define SHARED_WIDGETS(PAGE_TITLE) \ - WINDOW_SHIM(PAGE_TITLE, kWindowSize.width, kWindowSize.height ), /* WIDX_BACKGROUND, WIDX_TITLE, WIDX_CLOSE */ \ - MakeWidget({ 0, 43 }, { kWindowSize.width, 177 }, WindowWidgetType::Resize, WindowColour::Secondary ), /* WIDX_PAGE_BACKGROUND */ \ - MakeTab ({ 3, 17 } ), /* WIDX_TAB_1 */ \ - MakeTab ({ 34, 17 } ), /* WIDX_TAB_2 */ \ - MakeTab ({ 65, 17 } ), /* WIDX_TAB_3 */ \ - MakeTab ({ 96, 17 } ), /* WIDX_TAB_4 */ \ - MakeWidget({ 185, 200 }, { 109, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_MAPGEN_ACTION_GENERATE) + static constexpr auto makeMapGenWidgets = [](StringId title) { + return makeWidgets( + makeWindowShim(title, kWindowSize.width, kWindowSize.height), + MakeWidget({ 0, 43 }, { kWindowSize.width, 177 }, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab ({ 3, 17 }), + MakeTab ({ 34, 17 }), + MakeTab ({ 65, 17 }), + MakeTab ({ 96, 17 }), + MakeWidget({ 185, 200 }, { 109, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_MAPGEN_ACTION_GENERATE) + ); + }; - static constexpr Widget BaseWidgets[] = { - SHARED_WIDGETS(STR_MAPGEN_CAPTION_GENERATOR), + static constexpr auto BaseWidgets = makeWidgets( + makeMapGenWidgets(STR_MAPGEN_CAPTION_GENERATOR), MakeSpinnerWidgets ({165, 52}, { 50, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_COMMA16 ), // NB: 3 widgets MakeWidget ({216, 52}, { 21, 12}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_LINK_CHAIN), STR_MAINTAIN_SQUARE_MAP_TOOLTIP), MakeSpinnerWidgets ({238, 52}, { 50, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_POP16_COMMA16 ), // NB: 3 widgets @@ -139,32 +142,32 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({223, 107}, { 65, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_BROWSE ), // WIDX_HEIGHTMAP_BROWSE MakeWidget ({ 10, 125}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_NORMALIZE ), // WIDX_HEIGHTMAP_NORMALIZE MakeWidget ({ 10, 141}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_SMOOTH_HEIGHTMAP), // WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP - MakeSpinnerWidgets({179, 157}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_STRENGTH{,_UP,_DOWN} - }; + MakeSpinnerWidgets({179, 157}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ) // WIDX_HEIGHTMAP_STRENGTH{,_UP,_DOWN} + ); - static constexpr Widget TerrainWidgets[] = { - SHARED_WIDGETS(STR_MAPGEN_CAPTION_TERRAIN), + static constexpr auto TerrainWidgets = makeWidgets( + makeMapGenWidgets(STR_MAPGEN_CAPTION_TERRAIN), MakeSpinnerWidgets({179, 52}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_LOW{,_UP,_DOWN} MakeSpinnerWidgets({179, 70}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_HIGH{,_UP,_DOWN} MakeWidget ({179, 88}, { 47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_BASE_LAND_TIP ), MakeWidget ({236, 88}, { 47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP), MakeWidget ({ 10, 106}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_OPTION_RANDOM_TERRAIN ), - MakeWidget ({ 10, 122}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_SMOOTH_TILE), // WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES - }; + MakeWidget ({ 10, 122}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_SMOOTH_TILE) // WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES + ); - static constexpr Widget WaterWidgets[] = { - SHARED_WIDGETS(STR_MAPGEN_CAPTION_WATER), + static constexpr auto WaterWidgets = makeWidgets( + makeMapGenWidgets(STR_MAPGEN_CAPTION_WATER), MakeSpinnerWidgets({179, 52}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets - MakeWidget ({ 10, 70}, {255, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_BEACHES_WATER_BODIES), - }; + MakeWidget ({ 10, 70}, {255, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_BEACHES_WATER_BODIES) + ); - static constexpr Widget ForestsWidgets[] = { - SHARED_WIDGETS(STR_MAPGEN_CAPTION_FORESTS), + static constexpr auto ForestsWidgets = makeWidgets( + makeMapGenWidgets(STR_MAPGEN_CAPTION_FORESTS), MakeWidget ({ 10, 52}, {255, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_OPTION_PLACE_TREES), MakeSpinnerWidgets({179, 70}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TREE_LAND_RATIO{,_UP,_DOWN} MakeSpinnerWidgets({179, 88}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TREE_ALTITUDE_MIN{,_UP,_DOWN} - MakeSpinnerWidgets({179, 106}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TREE_ALTITUDE_MAX{,_UP,_DOWN} - }; + MakeSpinnerWidgets({179, 106}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary) // WIDX_TREE_ALTITUDE_MAX{,_UP,_DOWN} + ); static std::span PageWidgets[WINDOW_MAPGEN_PAGE_COUNT] = { BaseWidgets, diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 544970c531..dcb92f2ba0 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -60,8 +60,8 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_MAZE_CONSTRUCTION, WIDX_MAZE_EXIT); // clang-format off - static constexpr Widget window_maze_construction_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_maze_construction_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 3, 17}, {160, 55}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_MODE ), MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ), MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ), @@ -94,8 +94,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 9, 178}, { 70, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_CONSTRUCTION_ENTRANCE, STR_RIDE_CONSTRUCTION_ENTRANCE_TIP ), MakeWidget({87, 178}, { 70, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_CONSTRUCTION_EXIT, STR_RIDE_CONSTRUCTION_EXIT_TIP ), MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ), - MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ), - }; + MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ) + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 8e6ebe6aa6..8f05e10f7a 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -63,29 +63,30 @@ namespace OpenRCT2::Ui::Windows // clang-format off - #define MAIN_MULTIPLAYER_WIDGETS \ - WINDOW_SHIM(kStringIdNone, 340, 240), \ - MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), /* content panel */ \ - MakeTab ({ 3, 17}, STR_SHOW_SERVER_INFO_TIP), /* tab */ \ - MakeTab ({ 34, 17}, STR_PLAYERS_TIP ), /* tab */ \ - MakeTab ({ 65, 17}, STR_GROUPS_TIP ), /* tab */ \ - MakeTab ({ 96, 17}, STR_OPTIONS_TIP ) /* tab */ + static constexpr auto kMainMultiplayerWidgets = makeWidgets( + makeWindowShim(kStringIdNone, 340, 240), + MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), + MakeTab ({ 3, 17}, STR_SHOW_SERVER_INFO_TIP), + MakeTab ({ 34, 17}, STR_PLAYERS_TIP ), + MakeTab ({ 65, 17}, STR_GROUPS_TIP ), + MakeTab ({ 96, 17}, STR_OPTIONS_TIP ) + ); - static constexpr Widget window_multiplayer_information_widgets[] = { - MAIN_MULTIPLAYER_WIDGETS, - }; + static constexpr auto window_multiplayer_information_widgets = makeWidgets( + kMainMultiplayerWidgets + ); - static constexpr Widget window_multiplayer_players_widgets[] = { - MAIN_MULTIPLAYER_WIDGETS, + static constexpr auto window_multiplayer_players_widgets = makeWidgets( + kMainMultiplayerWidgets, MakeWidget({ 3, 46}, {173, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_PLAYER ), // Player name MakeWidget({176, 46}, { 83, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_GROUP ), // Player name MakeWidget({259, 46}, {100, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_LAST_ACTION), // Player name MakeWidget({359, 46}, { 42, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_PING ), // Player name - MakeWidget({ 3, 60}, {334, 177}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), // list - }; + MakeWidget({ 3, 60}, {334, 177}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL) // list + ); - static constexpr Widget window_multiplayer_groups_widgets[] = { - MAIN_MULTIPLAYER_WIDGETS, + static constexpr auto window_multiplayer_groups_widgets = makeWidgets( + kMainMultiplayerWidgets, MakeWidget({141, 46}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // default group MakeWidget({305, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH), MakeWidget({ 11, 65}, { 92, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_ADD_GROUP ), // add group button @@ -93,15 +94,15 @@ namespace OpenRCT2::Ui::Windows MakeWidget({215, 65}, { 92, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RENAME_GROUP ), // rename group button MakeWidget({ 72, 80}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // selected group MakeWidget({236, 81}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH), - MakeWidget({ 3, 94}, {314, 207}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), // permissions list - }; + MakeWidget({ 3, 94}, {314, 207}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ) // permissions list + ); - static constexpr Widget window_multiplayer_options_widgets[] = { - MAIN_MULTIPLAYER_WIDGETS, + static constexpr auto window_multiplayer_options_widgets = makeWidgets( + kMainMultiplayerWidgets, MakeWidget({3, 50}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_LOG_CHAT, STR_LOG_CHAT_TIP ), MakeWidget({3, 64}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_LOG_SERVER_ACTIONS, STR_LOG_SERVER_ACTIONS_TIP ), - MakeWidget({3, 78}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ALLOW_KNOWN_KEYS_ONLY, STR_ALLOW_KNOWN_KEYS_ONLY_TIP), - }; + MakeWidget({3, 78}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ALLOW_KNOWN_KEYS_ONLY, STR_ALLOW_KNOWN_KEYS_ONLY_TIP) + ); static std::span window_multiplayer_page_widgets[] = { window_multiplayer_information_widgets, diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index 11b90e54fc..0f689d2e3a 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -25,9 +25,9 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_network_status_widgets[] = { - WINDOW_SHIM(kStringIdEmpty, 320, 90) - }; + static constexpr auto window_network_status_widgets = makeWidgets( + makeWindowShim(kStringIdEmpty, 320, 90) + ); // clang-format on class NetworkStatusWindow final : public Window diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index ca62a94377..127af5be6a 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -48,15 +48,15 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_new_campaign_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_new_campaign_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget ({ 14, 24}, {126, 12}, WindowWidgetType::Label, WindowColour::Primary, kStringIdEmpty ), // ride label MakeWidget ({100, 24}, {242, 12}, WindowWidgetType::DropdownMenu, WindowColour::Primary, kStringIdEmpty ), // ride dropdown MakeWidget ({330, 25}, { 11, 10}, WindowWidgetType::Button, WindowColour::Primary, STR_DROPDOWN_GLYPH ), // ride dropdown button MakeWidget ({ 14, 41}, {126, 14}, WindowWidgetType::Label, WindowColour::Primary, STR_LENGTH_OF_TIME ), // weeks label MakeSpinnerWidgets({120, 41}, {100, 14}, WindowWidgetType::Spinner, WindowColour::Primary, kStringIdEmpty ), // weeks (3 widgets) - MakeWidget ({ 14, 89}, {322, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_MARKETING_START_THIS_MARKETING_CAMPAIGN), // start button - }; + MakeWidget ({ 14, 89}, {322, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_MARKETING_START_THIS_MARKETING_CAMPAIGN) // start button + ); // clang-format on class NewCampaignWindow final : public Window diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 07f446da1f..20c19b4d4e 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -209,8 +209,8 @@ namespace OpenRCT2::Ui::Windows static constexpr ScreenSize GroupTrackTypeSize{ GroupByTrackTypeWidth, 14 }; // clang-format off - static constexpr Widget window_new_ride_widgets[] = { - WINDOW_SHIM(WindowTitle, WindowWidth, kWindowHeight), + static constexpr auto window_new_ride_widgets = makeWidgets( + makeWindowShim(WindowTitle, WindowWidth, kWindowHeight), MakeWidget({ 0, 43}, {601, 339}, WindowWidgetType::Resize, WindowColour::Secondary ), MakeTab ({ 3, 17}, STR_TRANSPORT_RIDES_TIP ), MakeTab ({ 34, 17}, STR_GENTLE_RIDES_TIP ), @@ -226,8 +226,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({265, 68}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Tertiary, ImageId(SPR_FINANCE), STR_FINANCES_RESEARCH_TIP ), MakeWidget({ 4, 46}, {211, 14}, WindowWidgetType::TextBox, WindowColour::Secondary ), MakeWidget({218, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_OBJECT_SEARCH_CLEAR ), - MakeWidget(GroupByTrackTypeOrigin, GroupTrackTypeSize, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GROUP_BY_TRACK_TYPE, STR_GROUP_BY_TRACK_TYPE_TIP ), - }; + MakeWidget(GroupByTrackTypeOrigin, GroupTrackTypeSize, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GROUP_BY_TRACK_TYPE, STR_GROUP_BY_TRACK_TYPE_TIP ) + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 5cd76fb234..ad55924343 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -40,11 +40,11 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_news_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_news_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({372, 18}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_TAB_GEARS_0)), // settings - MakeWidget({ 4, 44}, {392, 252}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL), // scroll - }; + MakeWidget({ 4, 44}, {392, 252}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL) // scroll + ); // clang-format on class NewsWindow final : public Window diff --git a/src/openrct2-ui/windows/NewsOptions.cpp b/src/openrct2-ui/windows/NewsOptions.cpp index 18285ae48e..baf8988a5d 100644 --- a/src/openrct2-ui/windows/NewsOptions.cpp +++ b/src/openrct2-ui/windows/NewsOptions.cpp @@ -73,8 +73,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget WindowNewsOptionsWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto WindowNewsOptionsWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {400, 257}, WindowWidgetType::Resize, WindowColour::Secondary), // Tab content panel MakeTab ({ 3, 17} ), // Park tab MakeTab ({34, 17} ), // Ride tab @@ -87,8 +87,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ), MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ), MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ), - MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ), - }; + MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ) + ); // clang-format on class NewsOptionsWindow final : public Window diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index 5b1db3d7a4..7199f2462a 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -34,6 +34,7 @@ namespace OpenRCT2::Ui::Windows { #ifndef DISABLE_HTTP + // TODO: move to its own compilation unit class ObjectDownloader { private: @@ -279,18 +280,18 @@ namespace OpenRCT2::Ui::Windows constexpr int32_t TYPE_COL_LEFT = 5 * WW_LESS_PADDING / 8 + 1; // clang-format off - static constexpr Widget window_object_load_error_widgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto window_object_load_error_widgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ NAME_COL_LEFT, 57}, {108, 14}, WindowWidgetType::TableHeader, WindowColour::Primary, STR_OBJECT_NAME ), // 'Object name' header MakeWidget({SOURCE_COL_LEFT, 57}, {166, 14}, WindowWidgetType::TableHeader, WindowColour::Primary, STR_OBJECT_SOURCE ), // 'Object source' header MakeWidget({ TYPE_COL_LEFT, 57}, {166, 14}, WindowWidgetType::TableHeader, WindowColour::Primary, STR_OBJECT_TYPE ), // 'Object type' header MakeWidget({ NAME_COL_LEFT, 70}, {442, 298}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL ), // Scrollable list area MakeWidget({ NAME_COL_LEFT, 377}, {145, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_COPY_SELECTED, STR_COPY_SELECTED_TIP), // Copy selected button - MakeWidget({ 152, 377}, {145, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_COPY_ALL, STR_COPY_ALL_TIP ), // Copy all button + MakeWidget({ 152, 377}, {145, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_COPY_ALL, STR_COPY_ALL_TIP ) // Copy all button #ifndef DISABLE_HTTP - MakeWidget({ 300, 377}, {146, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_DOWNLOAD_ALL, STR_DOWNLOAD_ALL_TIP ), // Download all button + , MakeWidget({ 300, 377}, {146, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_DOWNLOAD_ALL, STR_DOWNLOAD_ALL_TIP ) // Download all button #endif - }; + ); // clang-format on /** diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 0537e5800d..feffed7e52 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -252,20 +252,21 @@ namespace OpenRCT2::Ui::Windows static constexpr int32_t WW = 310; static constexpr int32_t WH = 332; - #define MAIN_OPTIONS_WIDGETS \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, 43 }, { WW, 289 }, WindowWidgetType::Resize, WindowColour::Secondary), \ - MakeTab({ 3, 17 }, STR_OPTIONS_DISPLAY_TIP), \ - MakeTab({ 34, 17 }, STR_OPTIONS_RENDERING_TIP), \ - MakeTab({ 65, 17 }, STR_OPTIONS_CULTURE_TIP), \ - MakeTab({ 96, 17 }, STR_OPTIONS_AUDIO_TIP), \ - MakeTab({ 127, 17 }, STR_OPTIONS_INTERFACE_TIP), \ - MakeTab({ 158, 17 }, STR_OPTIONS_CONTROLS_TIP), \ - MakeTab({ 189, 17 }, STR_OPTIONS_MISCELLANEOUS_TIP), \ + static constexpr auto kMainOptionsWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), + MakeWidget({ 0, 43 }, { WW, 289 }, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab({ 3, 17 }, STR_OPTIONS_DISPLAY_TIP), + MakeTab({ 34, 17 }, STR_OPTIONS_RENDERING_TIP), + MakeTab({ 65, 17 }, STR_OPTIONS_CULTURE_TIP), + MakeTab({ 96, 17 }, STR_OPTIONS_AUDIO_TIP), + MakeTab({ 127, 17 }, STR_OPTIONS_INTERFACE_TIP), + MakeTab({ 158, 17 }, STR_OPTIONS_CONTROLS_TIP), + MakeTab({ 189, 17 }, STR_OPTIONS_MISCELLANEOUS_TIP), MakeTab({ 220, 17 }, STR_OPTIONS_ADVANCED) + ); - static constexpr Widget window_options_display_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_display_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget ({ 5, 53}, {300, 64}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_GROUP_WINDOW ), // Window group MakeWidget ({ 10, 67}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_FULLSCREEN_MODE, STR_FULLSCREEN_MODE_TIP ), // Fullscreen MakeWidget ({155, 68}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), @@ -289,14 +290,14 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 5, 188}, {300, 64}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_GROUP_BEHAVIOUR ), // Behaviour group MakeWidget ({ 11, 203}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_STEAM_OVERLAY_PAUSE, STR_STEAM_OVERLAY_PAUSE_TIP ), // Pause on steam overlay MakeWidget ({ 11, 218}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS, STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS_TIP), // Minimise fullscreen focus loss - MakeWidget ({ 11, 233}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_SCREENSAVER, STR_DISABLE_SCREENSAVER_TIP ), // Disable screensaver - }; + MakeWidget ({ 11, 233}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_SCREENSAVER, STR_DISABLE_SCREENSAVER_TIP ) // Disable screensaver + ); constexpr int32_t kFrameRenderingStart = 53; constexpr int32_t kFrameEffectStart = 163; - static constexpr Widget window_options_rendering_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_rendering_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget({ 5, kFrameRenderingStart + 0}, {300, 108}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_RENDERING_GROUP ), // Rendering group MakeWidget({ 10, kFrameRenderingStart + 15}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_SMOOTHING, STR_TILE_SMOOTHING_TIP ), // Landscape smoothing MakeWidget({ 10, kFrameRenderingStart + 30}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GRIDLINES, STR_GRIDLINES_TIP ), // Gridlines @@ -312,11 +313,11 @@ namespace OpenRCT2::Ui::Windows MakeWidget({25, kFrameEffectStart + 30}, {266, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ENABLE_LIGHTING_EFFECTS, STR_ENABLE_LIGHTING_EFFECTS_TIP ), // Enable light fx MakeWidget({40, kFrameEffectStart + 45}, {251, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ENABLE_LIGHTING_VEHICLES, STR_ENABLE_LIGHTING_VEHICLES_TIP), // Enable light fx for vehicles MakeWidget({10, kFrameEffectStart + 60}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RENDER_WEATHER_EFFECTS, STR_RENDER_WEATHER_EFFECTS_TIP ), // Render weather effects - MakeWidget({25, kFrameEffectStart + 75}, {266, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP), // Disable lightning effect - }; + MakeWidget({25, kFrameEffectStart + 75}, {266, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP) // Disable lightning effect + ); - static constexpr Widget window_options_culture_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_culture_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget({ 10, 53}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_OPTIONS_LANGUAGE, STR_LANGUAGE_TIP ), // language MakeWidget({155, 53}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRING ), MakeWidget({288, 54}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_LANGUAGE_TIP ), @@ -334,11 +335,11 @@ namespace OpenRCT2::Ui::Windows MakeWidget({288, 114}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_HEIGHT_LABELS_UNITS_TIP), MakeWidget({ 10, 128}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DATE_FORMAT, STR_DATE_FORMAT_TIP ), // Date format MakeWidget({155, 128}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), - MakeWidget({288, 129}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DATE_FORMAT_TIP ), - }; + MakeWidget({288, 129}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DATE_FORMAT_TIP ) + ); - static constexpr Widget window_options_audio_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_audio_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget({ 10, 53}, {290, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Audio device MakeWidget({288, 54}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_AUDIO_DEVICE_TIP ), MakeWidget({ 10, 69}, {220, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MASTER_VOLUME, STR_MASTER_VOLUME_TIP), // Enable / disable master sound @@ -350,13 +351,13 @@ namespace OpenRCT2::Ui::Windows MakeWidget({288, 128}, { 11, 11}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_TITLE_MUSIC_TIP ), MakeWidget({155, 68}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Master volume MakeWidget({155, 83}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Sound effect volume - MakeWidget({155, 98}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Music volume - }; + MakeWidget({155, 98}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ) // Music volume + ); constexpr int32_t kControlsGroupStart = 53; - static constexpr Widget window_options_controls_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_controls_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget({ 5, kControlsGroupStart + 0}, {300,137}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CONTROLS_GROUP ), // Controls group MakeWidget({ 10, kControlsGroupStart + 13}, {290, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP ), // Edge scrolling MakeWidget({ 10, kControlsGroupStart + 30}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_TRAP_MOUSE, STR_TRAP_MOUSE_TIP ), // Trap mouse @@ -365,14 +366,14 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 10, kControlsGroupStart + 75}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_WINDOW_BUTTONS_ON_THE_LEFT, STR_WINDOW_BUTTONS_ON_THE_LEFT_TIP), // Window buttons on the left MakeWidget({ 10, kControlsGroupStart + 90}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_ENLARGED_UI, STR_ENLARGED_UI_TIP ), MakeWidget({ 25, kControlsGroupStart + 105}, {275, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_TOUCH_ENHANCEMENTS, STR_TOUCH_ENHANCEMENTS_TIP ), - MakeWidget({155, kControlsGroupStart + 120}, {145, 13}, WindowWidgetType::Button, WindowColour::Secondary, STR_HOTKEY, STR_HOTKEY_TIP ), // Set hotkeys buttons - }; + MakeWidget({155, kControlsGroupStart + 120}, {145, 13}, WindowWidgetType::Button, WindowColour::Secondary, STR_HOTKEY, STR_HOTKEY_TIP ) // Set hotkeys buttons + ); constexpr int32_t kThemesGroupStart = 53; constexpr int32_t kToolbarGroupStart = kThemesGroupStart + 52; - static constexpr Widget window_options_interface_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_interface_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget({ 5, kThemesGroupStart + 0}, {300, 48}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_THEMES_GROUP ), // Themes group MakeWidget({ 10, kThemesGroupStart + 14}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_THEMES_LABEL_CURRENT_THEME, STR_CURRENT_THEME_TIP ), // Themes MakeWidget({155, kThemesGroupStart + 14}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRING ), @@ -389,16 +390,16 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 24, kToolbarGroupStart + 76}, {162, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_MUTE_BUTTON_ON_TOOLBAR, STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute MakeWidget({155, kToolbarGroupStart + 76}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHAT_BUTTON_ON_TOOLBAR, STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat MakeWidget({ 24, kToolbarGroupStart + 91}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR, STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom - MakeWidget({155, kToolbarGroupStart + 91}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ROTATE_ANTI_CLOCKWISE, STR_ROTATE_VIEW_ANTI_CLOCKWISE_IN_TOOLBAR_TIP), // Rotate anti-clockwise - }; + MakeWidget({155, kToolbarGroupStart + 91}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ROTATE_ANTI_CLOCKWISE, STR_ROTATE_VIEW_ANTI_CLOCKWISE_IN_TOOLBAR_TIP) // Rotate anti-clockwise + ); constexpr int32_t kTitleSequenceStart = 53; constexpr int32_t kScenarioGroupStart = kTitleSequenceStart + 35; constexpr int32_t kScenarioOptionsGroupStart = kScenarioGroupStart + 55; constexpr int32_t kTweaksStart = kScenarioOptionsGroupStart + 39; - static constexpr Widget window_options_misc_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_misc_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget( { 5, kTitleSequenceStart + 0}, {300, 31}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_TITLE_SEQUENCE ), MakeDropdownWidgets({ 10, kTitleSequenceStart + 15}, {290, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRINGID, STR_TITLE_SEQUENCE_TIP), // Title sequence dropdown @@ -418,15 +419,15 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 10, kTweaksStart + 60}, {290, 15}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_AUTO_OPEN_SHOPS, STR_AUTO_OPEN_SHOPS_TIP ), // Automatically open shops & stalls MakeWidget({ 10, kTweaksStart + 77}, {165, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DEFAULT_INSPECTION_INTERVAL, STR_DEFAULT_INSPECTION_INTERVAL_TIP), MakeWidget({175, kTweaksStart + 76}, {125, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Default inspection time dropdown - MakeWidget({288, kTweaksStart + 77}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DEFAULT_INSPECTION_INTERVAL_TIP ), // Default inspection time dropdown button - }; + MakeWidget({288, kTweaksStart + 77}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DEFAULT_INSPECTION_INTERVAL_TIP ) // Default inspection time dropdown button + ); constexpr int32_t kRCT1Start = 53; constexpr int32_t kSavingStart = kRCT1Start + 54; constexpr int32_t kAdvancedStart = kSavingStart + 84; - static constexpr Widget window_options_advanced_widgets[] = { - MAIN_OPTIONS_WIDGETS, + static constexpr auto window_options_advanced_widgets = makeWidgets( + kMainOptionsWidgets, MakeWidget ({ 5, kRCT1Start + 0}, {300, 50}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_GROUP_RCT1 ), MakeWidget ({ 10, kRCT1Start + 16}, {276, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_PATH_TO_RCT1, STR_PATH_TO_RCT1_TIP ), // RCT 1 path label MakeWidget ({ 10, kRCT1Start + 30}, {290, 14}, WindowWidgetType::Label, WindowColour::Secondary, kStringIdNone, STR_STRING_TOOLTIP ), // RCT 1 path path @@ -449,8 +450,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 10, kAdvancedStart + 46}, {135, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EXPORT_EMSCRIPTEN, kStringIdNone ), // Emscripten data export MakeWidget ({150, kAdvancedStart + 46}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_IMPORT_EMSCRIPTEN, kStringIdNone ), // Emscripten data import #endif - MakeWidget ({150, kAdvancedStart + 64}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_ASSET_PACKS_BUTTON, kStringIdNone ), // Asset packs - }; + MakeWidget ({150, kAdvancedStart + 64}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_ASSET_PACKS_BUTTON, kStringIdNone ) // Asset packs + ); static constexpr std::span window_options_page_widgets[] = { window_options_display_widgets, diff --git a/src/openrct2-ui/windows/OverwritePrompt.cpp b/src/openrct2-ui/windows/OverwritePrompt.cpp index 3f588adba2..13886626ff 100644 --- a/src/openrct2-ui/windows/OverwritePrompt.cpp +++ b/src/openrct2-ui/windows/OverwritePrompt.cpp @@ -32,11 +32,11 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_overwrite_prompt_widgets[] = { - WINDOW_SHIM(STR_FILEBROWSER_OVERWRITE_TITLE, OVERWRITE_WW, OVERWRITE_WH), + static constexpr auto window_overwrite_prompt_widgets = makeWidgets( + makeWindowShim(STR_FILEBROWSER_OVERWRITE_TITLE, OVERWRITE_WW, OVERWRITE_WH), MakeWidget({ 10, OVERWRITE_WH - 20 }, { 84, 11 }, WindowWidgetType::Button, WindowColour::Primary, STR_FILEBROWSER_OVERWRITE_TITLE), - MakeWidget({ OVERWRITE_WW - 95, OVERWRITE_WH - 20 }, { 85, 11 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL), - }; + MakeWidget({ OVERWRITE_WW - 95, OVERWRITE_WH - 20 }, { 85, 11 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL) + ); // clang-format on class OverwritePromptWindow final : public Window diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 700bc72381..9c614b9395 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -86,20 +86,23 @@ namespace OpenRCT2::Ui::Windows #pragma region Widgets -#define MAIN_PARK_WIDGETS(WW) \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, 43 }, { WW, 131 }, WindowWidgetType::Resize, WindowColour::Secondary), /* tab content panel */ \ - MakeTab({ 3, 17 }, STR_PARK_ENTRANCE_TAB_TIP), /* tab 1 */ \ - MakeTab({ 34, 17 }, STR_PARK_RATING_TAB_TIP), /* tab 2 */ \ - MakeTab({ 65, 17 }, STR_PARK_GUESTS_TAB_TIP), /* tab 3 */ \ - MakeTab({ 96, 17 }, STR_PARK_PRICE_TAB_TIP), /* tab 4 */ \ - MakeTab({ 127, 17 }, STR_PARK_STATS_TAB_TIP), /* tab 5 */ \ - MakeTab({ 158, 17 }, STR_PARK_OBJECTIVE_TAB_TIP), /* tab 6 */ \ - MakeTab({ 189, 17 }, STR_PARK_AWARDS_TAB_TIP) /* tab 7 */ - // clang-format off - static constexpr Widget _entranceWidgets[] = { - MAIN_PARK_WIDGETS(230), + static constexpr auto makeParkWidgets = [](int16_t width) { + return makeWidgets( + makeWindowShim(WINDOW_TITLE, width, WH), + MakeWidget({ 0, 43 }, { width, 131 }, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab({ 3, 17 }, STR_PARK_ENTRANCE_TAB_TIP), + MakeTab({ 34, 17 }, STR_PARK_RATING_TAB_TIP), + MakeTab({ 65, 17 }, STR_PARK_GUESTS_TAB_TIP), + MakeTab({ 96, 17 }, STR_PARK_PRICE_TAB_TIP), + MakeTab({ 127, 17 }, STR_PARK_STATS_TAB_TIP), + MakeTab({ 158, 17 }, STR_PARK_OBJECTIVE_TAB_TIP), + MakeTab({ 189, 17 }, STR_PARK_AWARDS_TAB_TIP) + ); + }; + + static constexpr auto _entranceWidgets = makeWidgets( + makeParkWidgets(230), MakeWidget({ 3, 46}, {202, 115}, WindowWidgetType::Viewport, WindowColour::Secondary ), // viewport MakeWidget({ 3, 161}, {202, 11}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // status MakeWidget({205, 49}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_OPEN_OR_CLOSE_PARK_TIP ), // open / close @@ -107,35 +110,35 @@ namespace OpenRCT2::Ui::Windows MakeWidget({205, 97}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP ), // locate MakeWidget({205, 121}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_PARK_TIP ), // rename MakeWidget({210, 51}, { 14, 15}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_CLOSE_BUTTON_0), STR_CLOSE_PARK_TIP ), - MakeWidget({210, 66}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0), STR_OPEN_PARK_TIP ), - }; + MakeWidget({210, 66}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0), STR_OPEN_PARK_TIP ) + ); - static constexpr Widget _ratingWidgets[] = { - MAIN_PARK_WIDGETS(255), - }; + static constexpr auto _ratingWidgets = makeWidgets( + makeParkWidgets(255) + ); - static constexpr Widget _guestsWidgets[] = { - MAIN_PARK_WIDGETS(255), - }; + static constexpr auto _guestsWidgets = makeWidgets( + makeParkWidgets(255) + ); - static constexpr Widget _priceWidgets[] = { - MAIN_PARK_WIDGETS(230), + static constexpr auto _priceWidgets = makeWidgets( + makeParkWidgets(230), MakeWidget ({ 21, 50}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary, STR_ADMISSION_PRICE), - MakeSpinnerWidgets({147, 50}, { 76, 14}, WindowWidgetType::Spinner, WindowColour::Secondary ), // Price (3 widgets) - }; + MakeSpinnerWidgets({147, 50}, { 76, 14}, WindowWidgetType::Spinner, WindowColour::Secondary ) // Price (3 widgets) + ); - static constexpr Widget _statsWidgets[] = { - MAIN_PARK_WIDGETS(230), - }; + static constexpr auto _statsWidgets = makeWidgets( + makeParkWidgets(230) + ); - static constexpr Widget _objectiveWidgets[] = { - MAIN_PARK_WIDGETS(230), - MakeWidget({7, 207}, {216, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ENTER_NAME_INTO_SCENARIO_CHART), // enter name - }; + static constexpr auto _objectiveWidgets = makeWidgets( + makeParkWidgets(230), + MakeWidget({7, 207}, {216, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ENTER_NAME_INTO_SCENARIO_CHART) // enter name + ); - static constexpr Widget _awardsWidgets[] = { - MAIN_PARK_WIDGETS(230), - }; + static constexpr auto _awardsWidgets = makeWidgets( + makeParkWidgets(230) + ); static std::span _pagedWidgets[] = { _entranceWidgets, diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index c0528aaa34..8b384f71a7 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -44,12 +44,12 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget PatrolAreaWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto PatrolAreaWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget ({27, 17}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0) ), // preview box MakeRemapWidget({28, 18}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_PATROL_AREA_TIP), // decrement size - MakeRemapWidget({54, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_PATROL_AREA_TIP ), // increment size - }; + MakeRemapWidget({54, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_PATROL_AREA_TIP ) // increment size + ); // clang-format on class PatrolAreaWindow final : public Window diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index 911573270d..8581afc32a 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -50,24 +50,25 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off -#define WINDOW_PLAYER_COMMON_WIDGETS \ - WINDOW_SHIM(STR_STRING, 192, 157), \ - MakeWidget({ 0, 43 }, { 192, 114 }, WindowWidgetType::Resize, WindowColour::Secondary), \ - MakeTab({ 3, 17 }), \ + static constexpr auto kCommonPlayerWidgets = makeWidgets( + makeWindowShim(STR_STRING, 192, 157), + MakeWidget({ 0, 43 }, { 192, 114 }, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab({ 3, 17 }), MakeTab({ 34, 17 }) + ); - static constexpr Widget window_player_overview_widgets[] = { - WINDOW_PLAYER_COMMON_WIDGETS, + static constexpr auto window_player_overview_widgets = makeWidgets( + kCommonPlayerWidgets, MakeWidget({ 3, 46}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Permission group MakeWidget({167, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), MakeWidget({179, 45}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_PLAYER_TIP), // Locate button MakeWidget({179, 69}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_KICK_PLAYER_TIP ), // Kick button - MakeWidget({ 3, 60}, {175, 61}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport - }; + MakeWidget({ 3, 60}, {175, 61}, WindowWidgetType::Viewport, WindowColour::Secondary ) // Viewport + ); - static constexpr Widget window_player_statistics_widgets[] = { - WINDOW_PLAYER_COMMON_WIDGETS, - }; + static constexpr auto window_player_statistics_widgets = makeWidgets( + kCommonPlayerWidgets + ); static constexpr std::span window_player_page_widgets[] = { window_player_overview_widgets, diff --git a/src/openrct2-ui/windows/ProgressWindow.cpp b/src/openrct2-ui/windows/ProgressWindow.cpp index 22d9e1b3b3..678fda3196 100644 --- a/src/openrct2-ui/windows/ProgressWindow.cpp +++ b/src/openrct2-ui/windows/ProgressWindow.cpp @@ -34,9 +34,9 @@ namespace OpenRCT2::Ui::Windows static constexpr int32_t kWindowHeight = 90; // clang-format off - static constexpr Widget kProgressWindowWidgets[] = { - WINDOW_SHIM(STR_STRINGID, kWindowWidth, kWindowHeight) - }; + static constexpr auto kProgressWindowWidgets = makeWidgets( + makeWindowShim(STR_STRINGID, kWindowWidth, kWindowHeight) + ); struct LoaderVehicleStyle { diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index d3113436bc..7ecd15dbd6 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -32,12 +32,11 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_ride_refurbish_widgets[] = - { - WINDOW_SHIM(STR_REFURBISH_RIDE, WW, WH), + static constexpr auto window_ride_refurbish_widgets = makeWidgets( + makeWindowShim(STR_REFURBISH_RIDE, WW, WH), MakeWidget({ 10, WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_REFURBISH), - MakeWidget({ WW - 95, WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL), - }; + MakeWidget({ WW - 95, WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL) + ); // clang-format on class RefurbishRidePromptWindow final : public Window diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 1877cfbaa8..93e9782f41 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -68,18 +68,18 @@ namespace OpenRCT2::Ui::Windows #pragma region Widgets // clang-format off - static constexpr Widget window_research_development_widgets[] = { - WINDOW_SHIM(STR_RESEARCH_AND_DEVELOPMENT, WW_DEVELOPMENT, WH_DEVELOPMENT), + static constexpr auto window_research_development_widgets = makeWidgets( + makeWindowShim(STR_RESEARCH_AND_DEVELOPMENT, WW_DEVELOPMENT, WH_DEVELOPMENT), MakeWidget({ 0, 43}, { WW_DEVELOPMENT, 153}, WindowWidgetType::Resize, WindowColour::Secondary ), MakeTab ({ 3, 17}, STR_RESEARCH_AND_DEVELOPMENT_TIP), MakeTab ({ 34, 17}, STR_FINANCES_RESEARCH_TIP ), MakeWidget({ 3, 47}, {WW_DEVELOPMENT - 10, 70}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_CURRENTLY_IN_DEVELOPMENT ), MakeWidget({ 3, 124}, {WW_DEVELOPMENT - 10, 65}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_LAST_DEVELOPMENT ), - MakeWidget({265, 161}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Tertiary , 0xFFFFFFFF, STR_RESEARCH_SHOW_DETAILS_TIP ), - }; + MakeWidget({265, 161}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Tertiary , 0xFFFFFFFF, STR_RESEARCH_SHOW_DETAILS_TIP ) + ); - static constexpr Widget window_research_funding_widgets[] = { - WINDOW_SHIM(STR_RESEARCH_FUNDING, WW_FUNDING, WH_FUNDING), + static constexpr auto window_research_funding_widgets = makeWidgets( + makeWindowShim(STR_RESEARCH_FUNDING, WW_FUNDING, WH_FUNDING), MakeWidget({ 0, 43}, { WW_FUNDING, 164}, WindowWidgetType::Resize, WindowColour::Secondary ), MakeTab ({ 3, 17}, STR_RESEARCH_AND_DEVELOPMENT_TIP ), MakeTab ({ 34, 17}, STR_FINANCES_RESEARCH_TIP ), @@ -93,8 +93,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 8, 147}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_THRILL_RIDES, STR_RESEARCH_NEW_THRILL_RIDES_TIP ), MakeWidget({ 8, 160}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_WATER_RIDES, STR_RESEARCH_NEW_WATER_RIDES_TIP ), MakeWidget({ 8, 173}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_SHOPS_AND_STALLS, STR_RESEARCH_NEW_SHOPS_AND_STALLS_TIP ), - MakeWidget({ 8, 186}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ), - }; + MakeWidget({ 8, 186}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ) + ); static constexpr std::span window_research_page_widgets[] = { window_research_development_widgets, diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 41b46bfb29..16a47d998c 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -242,23 +242,24 @@ namespace OpenRCT2::Ui::Windows // clang-format off constexpr int32_t RCT1_LIGHT_OFFSET = 4; - #define MAIN_RIDE_WIDGETS \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, 43}, {kMinimumWindowWidth, 137}, WindowWidgetType::Resize, WindowColour::Secondary), \ - MakeTab({ 3, 17 }, STR_VIEW_OF_RIDE_ATTRACTION_TIP), \ - MakeTab({ 34, 17 }, STR_VEHICLE_DETAILS_AND_OPTIONS_TIP), \ - MakeTab({ 65, 17 }, STR_OPERATING_OPTIONS_TIP), \ - MakeTab({ 96, 17 }, STR_MAINTENANCE_OPTIONS_TIP), \ - MakeTab({ 127, 17 }, STR_COLOUR_SCHEME_OPTIONS_TIP), \ - MakeTab({ 158, 17 }, STR_SOUND_AND_MUSIC_OPTIONS_TIP), \ - MakeTab({ 189, 17 }, STR_MEASUREMENTS_AND_TEST_DATA_TIP), \ - MakeTab({ 220, 17 }, STR_GRAPHS_TIP), \ - MakeTab({ 251, 17 }, STR_INCOME_AND_COSTS_TIP), \ + static constexpr auto kMainRideWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), + MakeWidget({ 0, 43}, {kMinimumWindowWidth, 137}, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab({ 3, 17 }, STR_VIEW_OF_RIDE_ATTRACTION_TIP), + MakeTab({ 34, 17 }, STR_VEHICLE_DETAILS_AND_OPTIONS_TIP), + MakeTab({ 65, 17 }, STR_OPERATING_OPTIONS_TIP), + MakeTab({ 96, 17 }, STR_MAINTENANCE_OPTIONS_TIP), + MakeTab({ 127, 17 }, STR_COLOUR_SCHEME_OPTIONS_TIP), + MakeTab({ 158, 17 }, STR_SOUND_AND_MUSIC_OPTIONS_TIP), + MakeTab({ 189, 17 }, STR_MEASUREMENTS_AND_TEST_DATA_TIP), + MakeTab({ 220, 17 }, STR_GRAPHS_TIP), + MakeTab({ 251, 17 }, STR_INCOME_AND_COSTS_TIP), MakeTab({ 282, 17 }, STR_CUSTOMER_INFORMATION_TIP) + ); // 0x009ADC34 - static constexpr Widget _mainWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _mainWidgets = makeWidgets( + kMainRideWidgets, MakeWidget({ 3, 60}, {288, 107}, WindowWidgetType::Viewport, WindowColour::Secondary ), MakeWidget({ 35, 46}, {222, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kWidgetContentEmpty, STR_VIEW_SELECTION ), MakeWidget({245, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_VIEW_SELECTION ), @@ -273,23 +274,23 @@ namespace OpenRCT2::Ui::Windows MakeWidget({296, 62}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_TEST_BUTTON_0), STR_TEST_RIDE_TIP ), MakeWidget({296, 76}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0), STR_OPEN_RIDE_TIP ), MakeWidget({ 3, 180}, {305, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_6_STRINGID ), - MakeWidget({297, 180}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), - }; + MakeWidget({297, 180}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ) + ); // 0x009ADDA8 - static constexpr Widget _vehicleWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _vehicleWidgets = makeWidgets( + kMainRideWidgets, MakeWidget ({ 7, 50}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), MakeWidget ({297, 51}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), MakeWidget ({ 7, 137}, {302, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_OPTION_REVERSE_TRAINS, STR_OPTION_REVERSE_TRAINS_TIP ), MakeWidget ({ 7, 154}, {302, 43}, WindowWidgetType::Scroll, WindowColour::Secondary, kStringIdEmpty ), MakeSpinnerWidgets({ 7, 203}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_VEHICLE_COUNT, STR_MAX_VEHICLES_TIP ), - MakeSpinnerWidgets({164, 203}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_1_CAR_PER_TRAIN, STR_MAX_CARS_PER_TRAIN_TIP), - }; + MakeSpinnerWidgets({164, 203}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_1_CAR_PER_TRAIN, STR_MAX_CARS_PER_TRAIN_TIP) + ); // 0x009ADEFC - static constexpr Widget _operatingWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _operatingWidgets = makeWidgets( + kMainRideWidgets, MakeSpinnerWidgets({157, 61}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_18_STRINGID ), // NB: 3 widgets MakeSpinnerWidgets({157, 75}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_LIFT_HILL_CHAIN_SPEED_VALUE ), // NB: 3 widgets MakeWidget ({ 7, 109}, { 80, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_WAIT_FOR, STR_WAIT_FOR_PASSENGERS_BEFORE_DEPARTING_TIP), @@ -306,24 +307,24 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 87, 109}, {222, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), MakeWidget ({297, 110}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), MakeWidget ({ 21, 89}, {129, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS, STR_NUMBER_OF_CIRCUITS_TIP ), - MakeSpinnerWidgets({157, 89}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS_VALUE ), // NB: 3 widgets - }; + MakeSpinnerWidgets({157, 89}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS_VALUE ) // NB: 3 widgets + ); // 0x009AE190 - static constexpr Widget _maintenanceWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _maintenanceWidgets = makeWidgets( + kMainRideWidgets, MakeWidget({107, 71}, {202, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdEmpty, STR_SELECT_HOW_OFTEN_A_MECHANIC_SHOULD_CHECK_THIS_RIDE), MakeWidget({297, 72}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_HOW_OFTEN_A_MECHANIC_SHOULD_CHECK_THIS_RIDE), MakeWidget({289, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_LOCATE_NEAREST_AVAILABLE_MECHANIC_TIP ), MakeWidget({265, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION), STR_REFURBISH_RIDE_TIP ), MakeWidget({241, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_NO_ENTRY), STR_DEBUG_FORCE_BREAKDOWN_TIP ), MakeProgressBar({107, 47}, { 147, 10}, COLOUR_BRIGHT_GREEN), - MakeProgressBar({107, 58}, { 147, 10}, COLOUR_BRIGHT_RED), - }; + MakeProgressBar({107, 58}, { 147, 10}, COLOUR_BRIGHT_RED) + ); // 0x009AE2A4 - static constexpr Widget _colourWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _colourWidgets = makeWidgets( + kMainRideWidgets, MakeWidget({ 3, 47}, { 68, 47}, WindowWidgetType::Spinner, WindowColour::Secondary ), MakeWidget({ 74, 49}, {239, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_14_STRINGID ), MakeWidget({301, 50}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_COLOUR_SCHEME_TO_CHANGE_TIP ), @@ -345,57 +346,57 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 99, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_1_TIP ), MakeWidget({119, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_2_TIP ), MakeWidget({100, 74}, {239, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RANDOM_COLOUR ), - MakeWidget({139, 190}, {110, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RANDOMISE_VEHICLE_COLOURS, STR_RANDOMISE_VEHICLE_COLOURS_TIP ), - }; + MakeWidget({139, 190}, {110, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RANDOMISE_VEHICLE_COLOURS, STR_RANDOMISE_VEHICLE_COLOURS_TIP ) + ); // 0x009AE4C8 - static constexpr Widget _musicWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _musicWidgets = makeWidgets( + kMainRideWidgets, MakeWidget({ 7, 47}, {302, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_PLAY_MUSIC, STR_SELECT_MUSIC_TIP ), MakeWidget({ 7, 62}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdEmpty ), MakeWidget({297, 63}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_MUSIC_STYLE_TIP), MakeWidget({154, 90}, {114, 114}, WindowWidgetType::FlatBtn, WindowColour::Secondary ), - MakeWidget({ 7, 90}, {500, 450}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), - }; + MakeWidget({ 7, 90}, {500, 450}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ) + ); // 0x009AE5DC - static constexpr Widget _measurementWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _measurementWidgets = makeWidgets( + kMainRideWidgets, MakeWidget({288, 194}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_FLOPPY), STR_SAVE_TRACK_DESIGN), MakeWidget({ 4, 127}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_SELECT_NEARBY_SCENERY ), MakeWidget({158, 127}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESET_SELECTION ), MakeWidget({ 4, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_SAVE ), - MakeWidget({158, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_CANCEL ), - }; + MakeWidget({158, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_CANCEL ) + ); // 0x009AE710 - static constexpr Widget _graphsWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _graphsWidgets = makeWidgets( + kMainRideWidgets, MakeWidget({ 3, 46}, {306, 112}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL, STR_LOGGING_DATA_FROM_TIP ), MakeWidget({ 3, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_VELOCITY, STR_SHOW_GRAPH_OF_VELOCITY_AGAINST_TIME_TIP ), MakeWidget({ 76, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_ALTITUDE, STR_SHOW_GRAPH_OF_ALTITUDE_AGAINST_TIME_TIP ), MakeWidget({149, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_VERT_G, STR_SHOW_GRAPH_OF_VERTICAL_ACCELERATION_AGAINST_TIME_TIP), - MakeWidget({222, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_LAT_G, STR_SHOW_GRAPH_OF_LATERAL_ACCELERATION_AGAINST_TIME_TIP ), - }; + MakeWidget({222, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_LAT_G, STR_SHOW_GRAPH_OF_LATERAL_ACCELERATION_AGAINST_TIME_TIP ) + ); // 0x009AE844 - static constexpr Widget _incomeWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _incomeWidgets = makeWidgets( + kMainRideWidgets, MakeWidget ({ 19, 50}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary ), MakeSpinnerWidgets({147, 50}, {162, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_6_CURRENCY2DP ), // NB: 3 widgets MakeWidget ({ 5, 62}, {306, 13}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SAME_PRICE_THROUGHOUT_PARK, STR_SAME_PRICE_THROUGHOUT_PARK_TIP), MakeWidget ({ 19, 94}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary ), MakeSpinnerWidgets({147, 94}, {162, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_SECONDARY_PRICE_VALUE ), // NB: 3 widgets - MakeWidget ({ 5, 106}, {306, 13}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SAME_PRICE_THROUGHOUT_PARK, STR_SAME_PRICE_THROUGHOUT_PARK_TIP), - }; + MakeWidget ({ 5, 106}, {306, 13}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SAME_PRICE_THROUGHOUT_PARK, STR_SAME_PRICE_THROUGHOUT_PARK_TIP) + ); // 0x009AE9C8 - static constexpr Widget _customerWidgets[] = { - MAIN_RIDE_WIDGETS, + static constexpr auto _customerWidgets = makeWidgets( + kMainRideWidgets, MakeWidget({289, 54}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION_TIP), MakeWidget({289, 78}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION_TIP ), - MakeWidget({289, 102}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION_TIP ), - }; + MakeWidget({289, 102}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION_TIP ) + ); static constexpr std::span PageWidgets[] = { _mainWidgets, diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 214b2ef784..bb3b2875c5 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -144,8 +144,8 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_ROTATE); // clang-format off - static constexpr Widget kRideConstructionWidgets[] = { - WINDOW_SHIM(kWindowTitle, WW, WH), + static constexpr auto kRideConstructionWidgets = makeWidgets( + makeWindowShim(kWindowTitle, WW, WH), MakeWidget ({ 3, 17}, { GW, 57}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_DIRECTION ), MakeWidget ({ 3, 76}, { GW, 41}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_SLOPE ), MakeWidget ({ 3, 120}, { GW, 41}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_ROLL_BANKING ), @@ -182,8 +182,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({144, 132}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_O_SHAPED_TRACK), STR_RIDE_CONSTRUCTION_O_SHAPED_ENCLOSED_TRACK_TIP ), MakeWidget ({118, 120}, { 89, 41}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_SEAT_ROT ), MakeSpinnerWidgets({123, 138}, { 58, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, 0, STR_RIDE_CONSTRUCTION_SELECT_SEAT_ROTATION_ANGLE_TIP), - MakeWidget ({161, 338}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_SIMULATE), STR_SIMULATE_RIDE_TIP ), - }; + MakeWidget ({161, 338}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_SIMULATE), STR_SIMULATE_RIDE_TIP ) + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 22e824d734..6aa81257f7 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -64,8 +64,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _rideListWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _rideListWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab page background MakeWidget({315, 60}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_TOGGLE_OPEN_CLOSE), STR_OPEN_OR_CLOSE_ALL_RIDES ), // open / close all toggle MakeWidget({150, 46}, {124, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // current information type @@ -77,8 +77,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 3, 60}, {334, 177}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), // list MakeWidget({320, 62}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_CLOSE_BUTTON_0) ), MakeWidget({320, 76}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0) ), - MakeWidget({315, 90}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_QUICK_DEMOLISH_RIDE ), - }; + MakeWidget({315, 90}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_QUICK_DEMOLISH_RIDE ) + ); // clang-format on enum diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index e0de853b00..a3e83ad142 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -40,13 +40,13 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _savePromptWidgets[] = { - WINDOW_SHIM(kStringIdNone, WW_SAVE, WH_SAVE), + static constexpr auto _savePromptWidgets = makeWidgets( + makeWindowShim(kStringIdNone, WW_SAVE, WH_SAVE), MakeWidget({ 2, 19}, {256, 12}, WindowWidgetType::LabelCentred, WindowColour::Primary, kStringIdEmpty ), // question/label MakeWidget({ 8, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_SAVE ), // save MakeWidget({ 91, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_DONT_SAVE), // don't save - MakeWidget({174, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL ), // cancel - }; + MakeWidget({174, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL ) // cancel + ); // clang-format on enum WindowQuitPromptWidgetIdx @@ -59,11 +59,11 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _quitPromptWidgets[] = { - WINDOW_SHIM(STR_QUIT_GAME_PROMPT_TITLE, WW_QUIT, WH_QUIT), + static constexpr auto _quitPromptWidgets = makeWidgets( + makeWindowShim(STR_QUIT_GAME_PROMPT_TITLE, WW_QUIT, WH_QUIT), MakeWidget({ 8, 19}, {78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_OK ), // ok - MakeWidget({91, 19}, {78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL), // cancel - }; + MakeWidget({91, 19}, {78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL) // cancel + ); // clang-format on static constexpr StringId window_save_prompt_labels[][2] = { diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 148f9d29a7..de308cfc2f 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -99,8 +99,8 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _scenarioSelectWidgets[] = { - WINDOW_SHIM(kWindowTitle, kWindowWidth, kWindowHeight), + static constexpr auto _scenarioSelectWidgets = makeWidgets( + makeWindowShim(kWindowTitle, kWindowWidth, kWindowHeight), MakeWidget({ kTabWidth + 1, kWidgetsStart }, { kWindowWidth, 284 }, WindowWidgetType::Resize, WindowColour::Secondary), // tab content panel MakeRemapWidget({ 3, kTabsStart + (kTabHeight * 0) }, { kTabWidth, kTabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 01 MakeRemapWidget({ 3, kTabsStart + (kTabHeight * 1) }, { kTabWidth, kTabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 02 @@ -112,8 +112,8 @@ namespace OpenRCT2::Ui::Windows MakeRemapWidget({ 3, kTabsStart + (kTabHeight * 7) }, { kTabWidth, kTabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 08 MakeRemapWidget({ 3, kTabsStart + (kTabHeight * 8) }, { kTabWidth, kTabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 09 MakeRemapWidget({ 3, kTabsStart + (kTabHeight * 8) }, { kTabWidth, kTabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 10 - MakeWidget({ kTabWidth + 3, kWidgetsStart + 1 }, { kWindowWidth - kSidebarWidth, 362 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), // level list - }; + MakeWidget({ kTabWidth + 3, kWidgetsStart + 1 }, { kWindowWidth - kSidebarWidth, 362 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL) // level list + ); // clang-format on class ScenarioSelectWindow final : public Window diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 814da43c71..8376f77700 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -109,8 +109,8 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_SCENERY, WIDX_SCENERY_EYEDROPPER_BUTTON); // clang-format off - static constexpr Widget WindowSceneryBaseWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WINDOW_SCENERY_MIN_WIDTH, WINDOW_SCENERY_MIN_HEIGHT), + static constexpr auto WindowSceneryBaseWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WINDOW_SCENERY_MIN_WIDTH, WINDOW_SCENERY_MIN_HEIGHT), MakeWidget ({ 0, 43}, {634, 99}, WindowWidgetType::Resize, WindowColour::Secondary ), // 8 0x009DE2C8 MakeWidget ({ 2, 62}, {607, 80}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), // 1000000 0x009DE418 MakeWidget ({609, 59}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_OBJECTS_90 ), // 2000000 0x009DE428 @@ -122,8 +122,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({609, 169}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SCENERY_CLUSTER), STR_SCENERY_CLUSTER_TIP ), // 40000000 0x009DE478 MakeWidget ({ 4, 46}, {211, 14}, WindowWidgetType::TextBox, WindowColour::Secondary ), MakeWidget ({218, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_OBJECT_SEARCH_CLEAR ), - MakeWidget ({539, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESTRICT_SCENERY, STR_RESTRICT_SCENERY_TIP ), - }; + MakeWidget ({539, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESTRICT_SCENERY, STR_RESTRICT_SCENERY_TIP ) + ); // clang-format on // Persistent between window instances diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index 626466ba7d..61917a3b00 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -38,8 +38,8 @@ namespace OpenRCT2::Ui::Windows ScatterToolDensity gWindowSceneryScatterDensity; // clang-format off - static constexpr Widget _sceneryScatterWidgets[] = { - WINDOW_SHIM(STR_SCENERY_SCATTER, 86, 100), + static constexpr auto _sceneryScatterWidgets = makeWidgets( + makeWindowShim(STR_SCENERY_SCATTER, 86, 100), MakeWidget ({20, 17}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_LAND_TOOL_SIZE_0) ), // preview box MakeRemapWidget({21, 18}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_LAND_TIP ), // decrement size @@ -48,8 +48,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 3, 55}, {80, 42}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_SCATTER_TOOL_DENSITY ), MakeRemapWidget({ 7, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_LOW, STR_SCATTER_TOOL_DENSITY_LOW ), // low amount MakeRemapWidget({31, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_MEDIUM, STR_SCATTER_TOOL_DENSITY_MEDIUM), // medium amount - MakeRemapWidget({55, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_HIGH, STR_SCATTER_TOOL_DENSITY_HIGH ), // high amount - }; + MakeRemapWidget({55, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_HIGH, STR_SCATTER_TOOL_DENSITY_HIGH ) // high amount + ); // clang-format on class SceneryScatterWindow final : public Window diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 6e83a2ee47..5b86c34529 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -63,14 +63,14 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _serverListWidgets[] = { - WINDOW_SHIM(STR_SERVER_LIST, 340, 90), + static constexpr auto _serverListWidgets = makeWidgets( + makeWindowShim(STR_SERVER_LIST, 340, 90), MakeWidget({100, 20}, {245, 12}, WindowWidgetType::TextBox, WindowColour::Secondary ), // player name text box MakeWidget({ 6, 37}, {489, 226}, WindowWidgetType::Scroll, WindowColour::Secondary ), // server list MakeWidget({ 6, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_FETCH_SERVERS ), // fetch servers button MakeWidget({112, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ADD_SERVER ), // add server button - MakeWidget({218, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_START_SERVER ), // start server button - }; + MakeWidget({218, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_START_SERVER ) // start server button + ); // clang-format on void JoinServer(std::string address); diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 1dc41e19c9..3f182d3997 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -46,8 +46,8 @@ namespace OpenRCT2::Ui::Windows static constexpr int32_t WH = 154; // clang-format off - static constexpr Widget _windowServerStartWidgets[] = { - WINDOW_SHIM(STR_START_SERVER, WW, WH), + static constexpr auto _windowServerStartWidgets = makeWidgets( + makeWindowShim(STR_START_SERVER, WW, WH), MakeWidget({ 120, 20 }, { 173, 13 }, WindowWidgetType::TextBox, WindowColour::Secondary), // port text box MakeWidget({ 120, 36 }, { 173, 13 }, WindowWidgetType::TextBox, WindowColour::Secondary), // name text box MakeWidget({ 120, 52 }, { 173, 13 }, WindowWidgetType::TextBox, WindowColour::Secondary), // description text box @@ -56,8 +56,8 @@ namespace OpenRCT2::Ui::Windows MakeSpinnerWidgets({ 120, 100 }, { 173, 12 }, WindowWidgetType::Spinner, WindowColour::Secondary,STR_SERVER_MAX_PLAYERS_VALUE), // max players (3 widgets) MakeWidget({ 6, 117 }, { 287, 14 }, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ADVERTISE,STR_ADVERTISE_SERVER_TIP), // advertise checkbox MakeWidget({ 6, WH - 6 - 13 }, { 101, 14 }, WindowWidgetType::Button, WindowColour::Secondary,STR_NEW_GAME), // start server button - MakeWidget({ 112, WH - 6 - 13 }, { 101, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_LOAD_GAME), // None - }; + MakeWidget({ 112, WH - 6 - 13 }, { 101, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_LOAD_GAME) // None + ); // clang-format on class ServerStartWindow final : public Window diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 804028b691..33db8b6372 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -42,12 +42,12 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _shortcutWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _shortcutWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({0, 43}, {350, 287}, WindowWidgetType::Resize, WindowColour::Secondary), MakeWidget({4, 47}, {412, 215}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL, STR_SHORTCUT_LIST_TIP ), - MakeWidget({4, WH-15}, {150, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_ACTION_RESET, STR_SHORTCUT_ACTION_RESET_TIP), - }; + MakeWidget({4, WH-15}, {150, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_ACTION_RESET, STR_SHORTCUT_ACTION_RESET_TIP) + ); // clang-format on static constexpr StringId CHANGE_WINDOW_TITLE = STR_SHORTCUT_CHANGE_TITLE; @@ -60,10 +60,10 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget window_shortcut_change_widgets[] = { - WINDOW_SHIM(CHANGE_WINDOW_TITLE, CHANGE_WW, CHANGE_WH), - MakeWidget({ 75, 56 }, { 100, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_REMOVE, STR_SHORTCUT_REMOVE_TIP), - }; + static constexpr auto window_shortcut_change_widgets = makeWidgets( + makeWindowShim(CHANGE_WINDOW_TITLE, CHANGE_WW, CHANGE_WH), + MakeWidget({ 75, 56 }, { 100, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_REMOVE, STR_SHORTCUT_REMOVE_TIP) + ); // clang-format on class ChangeShortcutWindow final : public Window @@ -577,16 +577,14 @@ namespace OpenRCT2::Ui::Windows WIDX_RESET_PROMPT_CANCEL }; - static constexpr Widget WindowResetShortcutKeysPromptWidgets[] = { - WINDOW_SHIM(STR_SHORTCUT_ACTION_RESET, RESET_PROMPT_WW, RESET_PROMPT_WH), - MakeWidget( - { 2, 30 }, { RESET_PROMPT_WW - 4, 12 }, WindowWidgetType::LabelCentred, WindowColour::Primary, - STR_RESET_SHORTCUT_KEYS_PROMPT), + // clang-format off + static constexpr auto WindowResetShortcutKeysPromptWidgets = makeWidgets( + makeWindowShim(STR_SHORTCUT_ACTION_RESET, RESET_PROMPT_WW, RESET_PROMPT_WH), + MakeWidget({ 2, 30 }, { RESET_PROMPT_WW - 4, 12 }, WindowWidgetType::LabelCentred, WindowColour::Primary, STR_RESET_SHORTCUT_KEYS_PROMPT), MakeWidget({ 8, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_RESET), - MakeWidget( - { RESET_PROMPT_WW - 95, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, - STR_SAVE_PROMPT_CANCEL), - }; + MakeWidget({ RESET_PROMPT_WW - 95, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL) + ); + // clang-format on class ResetShortcutKeysPrompt final : public Window { diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index d10a57b750..d656f77f43 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -49,14 +49,14 @@ namespace OpenRCT2::Ui::Windows // clang-format off // 0x9AEE00 - static constexpr Widget _signWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _signWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 3, 17}, {85, 60}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport MakeWidget({WW - 25, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_CHANGE_SIGN_TEXT_TIP ), // change sign button MakeWidget({WW - 25, 67}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_DEMOLISH_SIGN_TIP ), // demolish button MakeWidget({ 5, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, kWidgetContentEmpty, STR_SELECT_MAIN_SIGN_COLOUR_TIP), // Main colour - MakeWidget({ 17, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, kWidgetContentEmpty, STR_SELECT_TEXT_COLOUR_TIP ), // Text colour - }; + MakeWidget({ 17, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, kWidgetContentEmpty, STR_SELECT_TEXT_COLOUR_TIP ) // Text colour + ); // clang-format on class SignWindow final : public Window diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index b74e24297e..eda74254b3 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -84,41 +84,42 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_PEEP, WIDX_PATROL); validate_global_widx(WC_STAFF, WIDX_PICKUP); -#define MAIN_STAFF_WIDGETS \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, 43 }, { 190, 137 }, WindowWidgetType::Resize, WindowColour::Secondary), /* Resize */ \ - MakeTab({ 3, 17 }, STR_STAFF_OVERVIEW_TIP), /* Tab 1 */ \ - MakeTab({ 34, 17 }, STR_STAFF_OPTIONS_TIP), /* Tab 2 */ \ - MakeTab({ 65, 17 }, STR_STAFF_STATS_TIP) /* Tab 3 */ - // clang-format off - static constexpr Widget _staffOverviewWidgets[] = { - MAIN_STAFF_WIDGETS, + static constexpr auto kMainStaffWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), + MakeWidget({ 0, 43 }, { 190, 137 }, WindowWidgetType::Resize, WindowColour::Secondary), + MakeTab({ 3, 17 }, STR_STAFF_OVERVIEW_TIP), + MakeTab({ 34, 17 }, STR_STAFF_OPTIONS_TIP), + MakeTab({ 65, 17 }, STR_STAFF_STATS_TIP) + ); + + static constexpr auto _staffOverviewWidgets = makeWidgets( + kMainStaffWidgets, MakeWidget ({ 3, 47}, {162, 120}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport MakeWidget ({ 3, WH - 13}, {162, 11}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // Label at bottom of viewport MakeWidget ({WW - 25, 45}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PICKUP_BTN), STR_PICKUP_TIP ), // Pickup Button MakeWidget ({WW - 25, 69}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PATROL_BTN), STR_SET_PATROL_TIP ), // Patrol Button MakeWidget ({WW - 25, 93}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_STAFF_TIP ), // Rename Button MakeWidget ({WW - 25, 117}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // Locate Button - MakeWidget ({WW - 25, 141}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_FIRE_STAFF_TIP ), // Fire Button - }; + MakeWidget ({WW - 25, 141}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_FIRE_STAFF_TIP ) // Fire Button + ); //0x9AF910 - static constexpr Widget _staffOptionsWidgets[] = { - MAIN_STAFF_WIDGETS, + static constexpr auto _staffOptionsWidgets = makeWidgets( + kMainStaffWidgets, MakeWidget ({ 5, 50}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 1 MakeWidget ({ 5, 67}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 2 MakeWidget ({ 5, 84}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 3 MakeWidget ({ 5, 101}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 4 MakeWidget ({ 5, 50}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Costume Dropdown - MakeWidget ({WW - 17, 51}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_COSTUME_TIP), // Costume Dropdown Button - }; - // clang-format on + MakeWidget ({WW - 17, 51}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_COSTUME_TIP) // Costume Dropdown Button + ); // 0x9AF9F4 - static constexpr Widget _staffStatsWidgets[] = { - MAIN_STAFF_WIDGETS, - }; + static constexpr auto _staffStatsWidgets = makeWidgets( + kMainStaffWidgets + ); + // clang-format on static constexpr std::span window_staff_page_widgets[] = { _staffOverviewWidgets, diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index e1cc1350d0..518a524c20 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -35,11 +35,11 @@ namespace OpenRCT2::Ui::Windows // clang-format off // 0x9AFB4C - static constexpr Widget _staffFireWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _staffFireWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 10, WH - 20}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_YES ), - MakeWidget({WW - 95, WH - 20}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL), - }; + MakeWidget({WW - 95, WH - 20}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL) + ); // clang-format on class StaffFirePromptWindow final : public Window diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index e3c47fc52e..64ad5b9d5f 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -79,8 +79,8 @@ namespace OpenRCT2::Ui::Windows constexpr int32_t MAX_WH = 450; // clang-format off - static constexpr Widget _staffListWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _staffListWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, { WW, WH - 43}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel MakeTab ({ 3, 17}, STR_STAFF_HANDYMEN_TAB_TIP ), // handymen tab MakeTab ({ 34, 17}, STR_STAFF_MECHANICS_TAB_TIP ), // mechanics tab @@ -91,8 +91,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({165, 17}, { 145, 13}, WindowWidgetType::Button, WindowColour::Primary , kStringIdNone, STR_HIRE_STAFF_TIP ), // hire button MakeWidget({243, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_QUICK_FIRE_STAFF ), // quick fire staff MakeWidget({267, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PATROL_BTN), STR_SHOW_PATROL_AREA_TIP ), // show staff patrol area tool - MakeWidget({291, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_MAP), STR_SHOW_STAFF_ON_MAP_TIP), // show staff on map button - }; + MakeWidget({291, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_MAP), STR_SHOW_STAFF_ON_MAP_TIP) // show staff on map button + ); // clang-format on class StaffListWindow final : public Window diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index eb2e348925..b42f227dcd 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -34,11 +34,10 @@ namespace OpenRCT2::Ui::Windows WIDX_OKAY }; - static constexpr Widget _textInputWidgets[] = { - WINDOW_SHIM(kStringIdNone, WW, WH), + static constexpr auto _textInputWidgets = makeWidgets( + makeWindowShim(kStringIdNone, WW, WH), MakeWidget({ 170, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_CANCEL), - MakeWidget({ 10, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_OK), - }; + MakeWidget({ 10, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_OK)); class TextInputWindow final : public Window { diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 7a82d27f27..f381557b62 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -77,8 +77,8 @@ namespace OpenRCT2::Ui::Windows const uint16_t kWindowHeaderWidth = 152; // clang-format off - static constexpr Widget _themesWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _themesWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 43}, {320, 64}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel MakeTab ({ 3, 17}, STR_THEMES_TAB_SETTINGS_TIP ), // settings tab MakeTab ({ 34, 17}, STR_THEMES_TAB_MAIN_TIP ), // main ui tab @@ -102,8 +102,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 10, 54}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_RIDE_CONTROLS ), // rct1 ride lights MakeWidget({ 10, 69}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_PARK_CONTROLS ), // rct1 park lights MakeWidget({ 10, 84}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_SCENARIO_SELECTION_FONT ), // rct1 scenario font - MakeWidget({ 10, 99}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR ), // rct1 bottom toolbar - }; + MakeWidget({ 10, 99}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR ) // rct1 bottom toolbar + ); // clang-format on #pragma region Tabs diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 558928fd36..c1dc2d0d90 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -276,44 +276,45 @@ namespace OpenRCT2::Ui::Windows #define GBBT(GROUPTOP, row) ((GROUPTOP) + 14 + row * (PropertyButtonSize.height + VERTICAL_GROUPBOX_PADDING)) #define GBBB(GROUPTOP, row) (GBBT((GROUPTOP), row) + PropertyButtonSize.height) - #define MAIN_TILE_INSPECTOR_WIDGETS \ - WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({3, 57}, {WW - 6, WH - PADDING_BOTTOM - 58}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), /* Element list */ \ - /* X and Y spinners */ \ - MakeWidget ({ 4, 24}, {38, 14}, WindowWidgetType::Label, WindowColour::Secondary, STR_TILE_INSPECTOR_X_LABEL), \ - MakeSpinnerWidgets({20, 23}, {51, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), /* Spinner X (3 widgets) */ \ - MakeWidget ({74, 24}, {38, 14}, WindowWidgetType::Label, WindowColour::Secondary, STR_TILE_INSPECTOR_Y_LABEL), \ - MakeSpinnerWidgets({90, 23}, {51, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), /* Spinner Y (3 widgets) */ \ - /* Top buttons */ \ - MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 0, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_REMOVE_SELECTED_ELEMENT_TIP ), /* Remove button */ \ - MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 1, ToolbarButtonHalfSize, WindowWidgetType::Button, WindowColour::Secondary, STR_UP, STR_MOVE_SELECTED_ELEMENT_UP_TIP), /* Move up */ \ - MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 1 + ScreenSize{0, 12}, ToolbarButtonHalfSize, WindowWidgetType::Button, WindowColour::Secondary, STR_DOWN, STR_MOVE_SELECTED_ELEMENT_DOWN_TIP), /* Move down */ \ - MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 2, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_SELECTED_ELEMENT_TIP), /* Rotate button */ \ - MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 3, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_SORT), STR_TILE_INSPECTOR_SORT_TIP), /* Sort button */ \ - MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 4, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_PASTE), STR_TILE_INSPECTOR_PASTE_TIP), /* Paste button */ \ - MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 5, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_COPY), STR_TILE_INSPECTOR_COPY_TIP), /* Copy button */ \ - /* Column headers */ \ - MakeWidget(InvisibleFlagColumnXY, InvisibleFlagColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_INVISIBLE_SHORT, STR_TILE_INSPECTOR_FLAG_INVISIBLE), /* Invisible flag */ \ - MakeWidget(TypeColumnXY, TypeColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_ELEMENT_TYPE), /* Type */ \ - MakeWidget(BaseHeightColumnXY, BaseHeightColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT, STR_TILE_INSPECTOR_BASE_HEIGHT), /* Base height */ \ - MakeWidget(ClearanceHeightColumnXY, ClearanceHeightColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT, STR_TILE_INSPECTOR_CLEARANCE_HEIGHT), /* Clearance height */ \ - MakeWidget(DirectionColumnXY, DirectionColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_DIRECTION_SHORT, STR_TILE_INSPECTOR_DIRECTION), /* Direction */ \ - MakeWidget(GhostFlagColumnXY, GhostFlagColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_FLAG_GHOST_SHORT, STR_TILE_INSPECTOR_FLAG_GHOST), /* Ghost flag */ \ - MakeWidget(LastFlagColumnXY, LastFlagColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_FLAG_LAST_SHORT, STR_TILE_INSPECTOR_FLAG_LAST), /* Last of tile flag */ \ - /* Group boxes */ \ - MakeWidget({6, 0}, {WW - 12, 0}, WindowWidgetType::Groupbox, WindowColour::Secondary, kStringIdNone, kStringIdNone ), /* Details group box */ \ + static constexpr auto kMainTileInspectorWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), + MakeWidget({3, 57}, {WW - 6, WH - PADDING_BOTTOM - 58}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), /* Element list */ + /* X and Y spinners */ + MakeWidget ({ 4, 24}, {38, 14}, WindowWidgetType::Label, WindowColour::Secondary, STR_TILE_INSPECTOR_X_LABEL), + MakeSpinnerWidgets({20, 23}, {51, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), /* Spinner X (3 widgets) */ + MakeWidget ({74, 24}, {38, 14}, WindowWidgetType::Label, WindowColour::Secondary, STR_TILE_INSPECTOR_Y_LABEL), + MakeSpinnerWidgets({90, 23}, {51, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), /* Spinner Y (3 widgets) */ + /* Top buttons */ + MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 0, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_REMOVE_SELECTED_ELEMENT_TIP ), /* Remove button */ + MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 1, ToolbarButtonHalfSize, WindowWidgetType::Button, WindowColour::Secondary, STR_UP, STR_MOVE_SELECTED_ELEMENT_UP_TIP), /* Move up */ + MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 1 + ScreenSize{0, 12}, ToolbarButtonHalfSize, WindowWidgetType::Button, WindowColour::Secondary, STR_DOWN, STR_MOVE_SELECTED_ELEMENT_DOWN_TIP), /* Move down */ + MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 2, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_SELECTED_ELEMENT_TIP), /* Rotate button */ + MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 3, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_SORT), STR_TILE_INSPECTOR_SORT_TIP), /* Sort button */ + MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 4, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_PASTE), STR_TILE_INSPECTOR_PASTE_TIP), /* Paste button */ + MakeWidget(ToolbarButtonAnchor + ToolbarButtonOffsetX * 5, ToolbarButtonSize, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_COPY), STR_TILE_INSPECTOR_COPY_TIP), /* Copy button */ + /* Column headers */ + MakeWidget(InvisibleFlagColumnXY, InvisibleFlagColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_INVISIBLE_SHORT, STR_TILE_INSPECTOR_FLAG_INVISIBLE), /* Invisible flag */ + MakeWidget(TypeColumnXY, TypeColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_ELEMENT_TYPE), /* Type */ + MakeWidget(BaseHeightColumnXY, BaseHeightColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT, STR_TILE_INSPECTOR_BASE_HEIGHT), /* Base height */ + MakeWidget(ClearanceHeightColumnXY, ClearanceHeightColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT, STR_TILE_INSPECTOR_CLEARANCE_HEIGHT), /* Clearance height */ + MakeWidget(DirectionColumnXY, DirectionColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_DIRECTION_SHORT, STR_TILE_INSPECTOR_DIRECTION), /* Direction */ + MakeWidget(GhostFlagColumnXY, GhostFlagColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_FLAG_GHOST_SHORT, STR_TILE_INSPECTOR_FLAG_GHOST), /* Ghost flag */ + MakeWidget(LastFlagColumnXY, LastFlagColumnSize, WindowWidgetType::TableHeader, WindowColour::Secondary, STR_TILE_INSPECTOR_FLAG_LAST_SHORT, STR_TILE_INSPECTOR_FLAG_LAST), /* Last of tile flag */ + /* Group boxes */ + MakeWidget({6, 0}, {WW - 12, 0}, WindowWidgetType::Groupbox, WindowColour::Secondary, kStringIdNone, kStringIdNone ), /* Details group box */ MakeWidget({6, 0}, {WW - 12, 0}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_TILE_INSPECTOR_GROUPBOX_PROPERTIES, kStringIdNone ) /* Properties group box */ + ); - static constexpr Widget DefaultWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, - }; + static constexpr auto DefaultWidgets = makeWidgets( + kMainTileInspectorWidgets + ); constexpr int32_t NumSurfaceProperties = 4; constexpr int32_t NumSurfaceDetails = 4; constexpr int32_t SurfacePropertiesHeight = 16 + NumSurfaceProperties * 21; constexpr int32_t SurfaceDetailsHeight = 20 + NumSurfaceDetails * 11; - static constexpr Widget SurfaceWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, + static constexpr auto SurfaceWidgets = makeWidgets( + kMainTileInspectorWidgets, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_SURFACE_SPINNER_HEIGHT{,_INCREASE,_DECREASE} MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyButtonSize, WindowWidgetType::Button, WindowColour::Secondary, STR_TILE_INSPECTOR_SURFACE_REMOVE_FENCES), // WIDX_SURFACE_BUTTON_REMOVE_FENCES MakeWidget(PropertyRowCol({ 12, 0 }, 1, 1), PropertyButtonSize, WindowWidgetType::Button, WindowColour::Secondary, STR_TILE_INSPECTOR_SURFACE_RESTORE_FENCES), // WIDX_SURFACE_BUTTON_RESTORE_FENCES @@ -321,15 +322,15 @@ namespace OpenRCT2::Ui::Windows MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 3, 1), 2, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SURFACE_CHECK_CORNER_E MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 3, 1), 1, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SURFACE_CHECK_CORNER_S MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 3, 1), 0, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SURFACE_CHECK_CORNER_W - MakeWidget(PropertyRowCol({ 12, 0 }, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_SURFACE_DIAGONAL), // WIDX_SURFACE_CHECK_DIAGONAL - }; + MakeWidget(PropertyRowCol({ 12, 0 }, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_SURFACE_DIAGONAL) // WIDX_SURFACE_CHECK_DIAGONAL + ); constexpr int32_t NumPathProperties = 6; constexpr int32_t NumPathDetails = 3; constexpr int32_t PathPropertiesHeight = 16 + NumPathProperties * 21; constexpr int32_t PathDetailsHeight = 20 + NumPathDetails * 11; - static constexpr Widget PathWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, + static constexpr auto PathWidgets = makeWidgets( + kMainTileInspectorWidgets, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_PATH_SPINNER_HEIGHT{,_INCREASE,_DECREASE} MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_PATH_BROKEN), // WIDX_PATH_CHECK_BROKEN MakeWidget(PropertyRowCol({ 12, 0 }, 2, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_PATH_SLOPED), // WIDX_PATH_CHECK_SLOPED @@ -341,28 +342,28 @@ namespace OpenRCT2::Ui::Windows MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 1, 3), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_SW MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 0, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_W MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 1, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_NW - MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 2, 0), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_N - }; + MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 2, 0), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary) // WIDX_PATH_CHECK_EDGE_N + ); constexpr int32_t NumTrackProperties = 5; constexpr int32_t NumTrackDetails = 7; constexpr int32_t TrackPropertiesHeight = 16 + NumTrackProperties * 21; constexpr int32_t TrackDetailsHeight = 20 + NumTrackDetails * 11; - static constexpr Widget TrackWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, + static constexpr auto TrackWidgets = makeWidgets( + kMainTileInspectorWidgets, MakeWidget(PropertyRowCol({ 12, 0}, 0, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_ENTIRE_TRACK_PIECE), // WIDX_TRACK_CHECK_APPLY_TO_ALL MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 1, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TRACK_SPINNER_HEIGHT{,_INCREASE,_DECREASE} MakeWidget(PropertyRowCol({ 12, 0}, 2, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_CHAIN_LIFT), // WIDX_TRACK_CHECK_CHAIN_LIFT MakeWidget(PropertyRowCol({ 12, 0}, 3, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED), // WIDX_TRACK_CHECK_BRAKE_CLOSED - MakeWidget(PropertyRowCol({ 12, 0}, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_IS_INDESTRUCTIBLE), // WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE - }; + MakeWidget(PropertyRowCol({ 12, 0}, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_IS_INDESTRUCTIBLE) // WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE + ); constexpr int32_t NumSceneryProperties = 4; // The checkbox groups both count for 2 rows constexpr int32_t NumSceneryDetails = 3; constexpr int32_t SceneryPropertiesHeight = 16 + NumSceneryProperties * 21; constexpr int32_t SceneryDetailsHeight = 20 + NumSceneryDetails * 11; - static constexpr Widget SceneryWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, + static constexpr auto SceneryWidgets = makeWidgets( + kMainTileInspectorWidgets, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE} MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 0), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_QUARTER_N MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 2, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_QUARTER_E @@ -371,53 +372,53 @@ namespace OpenRCT2::Ui::Windows MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 1, 0), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_N MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 2, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_E MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 1, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_S - MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 0, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_W - }; + MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 0, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary) // WIDX_SCENERY_CHECK_COLLISION_W + ); constexpr int32_t NumEntranceProperties = 2; constexpr int32_t NumEntranceDetails = 4; constexpr int32_t EntrancePropertiesHeight = 16 + NumEntranceProperties * 21; constexpr int32_t EntranceDetailsHeight = 20 + NumEntranceDetails * 11; - static constexpr Widget EntranceWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, + static constexpr auto EntranceWidgets = makeWidgets( + kMainTileInspectorWidgets, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_ENTRANCE_SPINNER_HEIGHT{,_INCREASE,_DECREASE} - MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyButtonSize, WindowWidgetType::Button, WindowColour::Secondary, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE_TIP), // WIDX_ENTRANCE_BUTTON_MAKE_USABLE - }; + MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyButtonSize, WindowWidgetType::Button, WindowColour::Secondary, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE_TIP) // WIDX_ENTRANCE_BUTTON_MAKE_USABLE + ); constexpr int32_t NumWallProperties = 4; constexpr int32_t NumWallDetails = 2; constexpr int32_t WallPropertiesHeight = 16 + NumWallProperties * 21; constexpr int32_t WallDetailsHeight = 20 + NumWallDetails * 11; - static constexpr Widget WallWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, + static constexpr auto WallWidgets = makeWidgets( + kMainTileInspectorWidgets, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_WALL_SPINNER_HEIGHT{,_INCREASE,_DECREASE} MakeWidget(PropertyRowCol({ 12, 0 }, 1, 1), PropertyButtonSize, WindowWidgetType::DropdownMenu, WindowColour::Secondary), // WIDX_WALL_DROPDOWN_SLOPE MakeWidget(PropertyRowCol({ 12 + PropertyButtonSize.width - 12, 0 }, 1, 1), { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH), // WIDX_WALL_DROPDOWN_SLOPE_BUTTON MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 2, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_WALL_SPINNER_ANIMATION_FRAME{,_INCREASE,_DECREASE} - MakeWidget(PropertyRowCol({ 12, 0 }, 3, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS), // WIDX_WALL_ANIMATION_IS_BACKWARDS - }; + MakeWidget(PropertyRowCol({ 12, 0 }, 3, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS) // WIDX_WALL_ANIMATION_IS_BACKWARDS + ); constexpr int32_t NumLargeSceneryProperties = 1; constexpr int32_t NumLargeSceneryDetails = 3; constexpr int32_t LargeSceneryPropertiesHeight = 16 + NumLargeSceneryProperties * 21; constexpr int32_t LargeSceneryDetailsHeight = 20 + NumLargeSceneryDetails * 11; - static constexpr Widget LargeSceneryWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, - MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_LARGE_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE} - }; + static constexpr auto LargeSceneryWidgets = makeWidgets( + kMainTileInspectorWidgets, + MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary) // WIDX_LARGE_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE} + ); constexpr int32_t NumBannerProperties = 3; constexpr int32_t NumBannerDetails = 1; constexpr int32_t BannerPropertiesHeight = 16 + NumBannerProperties * 21; constexpr int32_t BannerDetailsHeight = 20 + NumBannerDetails * 11; - static constexpr Widget BannerWidgets[] = { - MAIN_TILE_INSPECTOR_WIDGETS, + static constexpr auto BannerWidgets = makeWidgets( + kMainTileInspectorWidgets, MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_BANNER_SPINNER_HEIGHT{,_INCREASE,_DECREASE} MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 3, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_NE MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 3, 3), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_SE MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 3), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_SW - MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_NW - }; + MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary) // WIDX_BANNER_CHECK_BLOCK_NW + ); static constexpr std::span PageWidgets[] = { DefaultWidgets, diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index bd1eee8377..077b8611f5 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -20,9 +20,8 @@ namespace OpenRCT2::Ui::Windows WIDX_EXIT, }; - static constexpr Widget _titleExitWidgets[] = { - MakeWidget({ 0, 0 }, { 40, 64 }, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_EXIT), STR_EXIT), - }; + static constexpr auto _titleExitWidgets = makeWidgets( + MakeWidget({ 0, 0 }, { 40, 64 }, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_EXIT), STR_EXIT)); class TitleExitWindow final : public Window { diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index b3386bf374..2e56e9a5f7 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -24,9 +24,8 @@ namespace OpenRCT2::Ui::Windows WIDX_LOGO }; - static constexpr Widget _titleLogoWidgets[] = { - MakeWidget({ 0, 0 }, { WW + 1, WH + 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary), - }; + static constexpr auto _titleLogoWidgets = makeWidgets( + MakeWidget({ 0, 0 }, { WW + 1, WH + 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary)); class TitleLogoWindow final : public Window { diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 582226de66..b7275d63db 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -46,13 +46,13 @@ namespace OpenRCT2::Ui::Windows static constexpr ScreenSize UpdateButtonDims = { MenuButtonDims.width * 4, 28 }; // clang-format off - static constexpr Widget _titleMenuWidgets[] = { + static constexpr auto _titleMenuWidgets = makeWidgets( MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_NEW_GAME), STR_START_NEW_GAME_TIP), MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_LOAD_GAME), STR_CONTINUE_SAVED_GAME_TIP), MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_G2_MENU_MULTIPLAYER), STR_SHOW_MULTIPLAYER_TIP), MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_TOOLBOX), STR_GAME_TOOLS_TIP), - MakeWidget({0, 0}, UpdateButtonDims, WindowWidgetType::Empty, WindowColour::Secondary, STR_UPDATE_AVAILABLE), - }; + MakeWidget({0, 0}, UpdateButtonDims, WindowWidgetType::Empty, WindowColour::Secondary, STR_UPDATE_AVAILABLE) + ); // clang-format on static void WindowTitleMenuScenarioselectCallback(const utf8* path) diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index b0f1381d82..4bb74c9319 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -19,9 +19,8 @@ namespace OpenRCT2::Ui::Windows WIDX_OPTIONS, }; - static constexpr Widget _windowTitleOptionsWidgets[] = { - MakeWidget({ 0, 0 }, { 80, 15 }, WindowWidgetType::Button, WindowColour::Tertiary, STR_OPTIONS, STR_OPTIONS_TIP), - }; + static constexpr auto _windowTitleOptionsWidgets = makeWidgets( + MakeWidget({ 0, 0 }, { 80, 15 }, WindowWidgetType::Button, WindowColour::Tertiary, STR_OPTIONS, STR_OPTIONS_TIP)); class TitleOptionsWindow final : public Window { diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index 2cb1fecbde..02a5bf412f 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -25,9 +25,8 @@ namespace OpenRCT2::Ui::Windows WIDX_BACKGROUND }; - static constexpr Widget _tooltipWidgets[] = { - MakeWidget({ 0, 0 }, { 200, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary), - }; + static constexpr auto _tooltipWidgets = makeWidgets( + MakeWidget({ 0, 0 }, { 200, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary)); class TooltipWindow final : public Window { diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 74700da9e9..de39d22d8f 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -235,7 +235,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion - static constexpr Widget _topToolbarWidgets[] = { + static constexpr auto _topToolbarWidgets = makeWidgets( MakeRemapWidget({ 0, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_TOOLBAR_PAUSE, STR_PAUSE_GAME_TIP ), // Pause MakeRemapWidget({ 60, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_TOOLBAR_FILE, STR_DISC_AND_GAME_OPTIONS_TIP ), // File menu MakeRemapWidget({250, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_G2_TOOLBAR_MUTE, STR_TOOLBAR_MUTE_TIP ), // Mute @@ -263,8 +263,8 @@ namespace OpenRCT2::Ui::Windows MakeRemapWidget({ 30, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Quaternary, SPR_TAB_TOOLBAR, STR_SHOW_RECENT_MESSAGES_TIP ), // News MakeRemapWidget({ 30, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_G2_TOOLBAR_MULTIPLAYER, STR_SHOW_MULTIPLAYER_STATUS_TIP ), // Network MakeRemapWidget({ 30, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_TAB_TOOLBAR, STR_TOOLBAR_CHAT_TIP ), // Chat - MakeWidget ({ 0, 0}, {10, 1}, WindowWidgetType::Empty, WindowColour::Primary ), // Artificial widget separator - }; + MakeWidget ({ 0, 0}, {10, 1}, WindowWidgetType::Empty, WindowColour::Primary ) // Artificial widget separator + ); // clang-format on class TopToolbar final : public Window diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index c9148205ab..be2c8b7fd4 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -41,17 +41,17 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _trackManageWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _trackManageWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 10, 24}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_RENAME), - MakeWidget({130, 24}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_DELETE), - }; + MakeWidget({130, 24}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_DELETE) + ); - static constexpr Widget _trackDeletePromptWidgets[] = { - WINDOW_SHIM(STR_DELETE_FILE, WW_DELETE_PROMPT, WH_DELETE_PROMPT), + static constexpr auto _trackDeletePromptWidgets = makeWidgets( + makeWindowShim(STR_DELETE_FILE, WW_DELETE_PROMPT, WH_DELETE_PROMPT), MakeWidget({ 10, 54}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_DELETE), - MakeWidget({130, 54}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL ), - }; + MakeWidget({130, 54}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL ) + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 01f2b5f0c7..714586dc03 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -67,13 +67,13 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_TRACK_DESIGN_PLACE, WIDX_ROTATE); // clang-format off - static constexpr Widget _trackPlaceWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _trackPlaceWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({173, 83}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ), MakeWidget({173, 59}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_MIRROR_ARROW), STR_MIRROR_IMAGE_TIP ), MakeWidget({ 4, 109}, {192, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_SELECT_A_DIFFERENT_DESIGN, STR_GO_BACK_TO_DESIGN_SELECTION_WINDOW_TIP), - MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary), - }; + MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary) + ); // clang-format on class TrackDesignPlaceWindow final : public Window diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index e92bac6c7e..275db2d047 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -54,16 +54,16 @@ namespace OpenRCT2::Ui::Windows validate_global_widx(WC_TRACK_DESIGN_LIST, WIDX_ROTATE); // clang-format off - static constexpr Widget _trackListWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _trackListWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 4, 18}, {218, 13}, WindowWidgetType::TableHeader, WindowColour::Primary, STR_SELECT_OTHER_RIDE ), MakeWidget({ 4, 32}, {124, 13}, WindowWidgetType::TextBox, WindowColour::Secondary ), MakeWidget({130, 32}, { 92, 13}, WindowWidgetType::Button, WindowColour::Primary, STR_OBJECT_SEARCH_CLEAR ), MakeWidget({ 4, 46}, {218, 381}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL, STR_CLICK_ON_DESIGN_TO_BUILD_IT_TIP), MakeWidget({224, 18}, {372, 219}, WindowWidgetType::FlatBtn, WindowColour::Primary ), MakeWidget({572, 405}, { ROTATE_AND_SCENERY_BUTTON_SIZE, ROTATE_AND_SCENERY_BUTTON_SIZE}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ), - MakeWidget({572, 381}, { ROTATE_AND_SCENERY_BUTTON_SIZE, ROTATE_AND_SCENERY_BUTTON_SIZE}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_SCENERY), STR_TOGGLE_SCENERY_TIP ), - }; + MakeWidget({572, 381}, { ROTATE_AND_SCENERY_BUTTON_SIZE, ROTATE_AND_SCENERY_BUTTON_SIZE}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_SCENERY), STR_TOGGLE_SCENERY_TIP ) + ); // clang-format on constexpr uint16_t TRACK_DESIGN_INDEX_UNLOADED = UINT16_MAX; diff --git a/src/openrct2-ui/windows/Transparency.cpp b/src/openrct2-ui/windows/Transparency.cpp index d7dd121fbc..02e4324570 100644 --- a/src/openrct2-ui/windows/Transparency.cpp +++ b/src/openrct2-ui/windows/Transparency.cpp @@ -63,9 +63,8 @@ namespace OpenRCT2::Ui::Windows #pragma endregion // clang-format off - static constexpr Widget _transparancyWidgets[] = - { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _transparancyWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 2, 17}, HIDE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_BUTTON_HIDE_VEGETATION), STR_SEE_THROUGH_VEGETATION), MakeWidget({ 27, 17}, HIDE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_BUTTON_HIDE_SCENERY), STR_SEE_THROUGH_SCENERY), MakeWidget({ 52, 17}, HIDE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_BUTTON_FOOTPATH), STR_SEE_THROUGH_PATHS), @@ -80,8 +79,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget({ 52, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, kStringIdNone, STR_INVISIBLE_PATHS), MakeWidget({ 77, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, kStringIdNone, STR_INVISIBLE_RIDES), MakeWidget({102, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, kStringIdNone, STR_INVISIBLE_VEHICLES), - MakeWidget({127, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, kStringIdNone, STR_INVISIBLE_SUPPORTS), - }; + MakeWidget({127, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, kStringIdNone, STR_INVISIBLE_SUPPORTS) + ); // clang-format on class TransparencyWindow final : public Window diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index d4d538f629..b7a9e14d81 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -53,8 +53,8 @@ namespace OpenRCT2::Ui::Windows static constexpr int32_t WH = 172; // clang-format off - static constexpr Widget _viewClippingWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _viewClippingWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget ({ 11, 19}, { 159, 11}, WindowWidgetType::Checkbox, WindowColour::Primary, STR_VIEW_CLIPPING_HEIGHT_ENABLE, STR_VIEW_CLIPPING_HEIGHT_ENABLE_TIP ), // clip enable/disable check box MakeWidget ({ 5, 36}, {WW - 10, 65}, WindowWidgetType::Groupbox, WindowColour::Primary, STR_VIEW_CLIPPING_VERTICAL_CLIPPING ), MakeSpinnerWidgets({ 90, 51}, { 79, 12}, WindowWidgetType::Spinner, WindowColour::Primary, kStringIdNone, STR_VIEW_CLIPPING_HEIGHT_VALUE_TOGGLE ), // clip height (3 widgets) @@ -62,8 +62,8 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({ 11, 83}, { 159, 11}, WindowWidgetType::Checkbox, WindowColour::Primary, STR_VIEW_CLIPPING_VERTICAL_CLIPPING_SEE_THROUGH, STR_VIEW_CLIPPING_VERTICAL_CLIPPING_SEE_THROUGH_TIP), // clip height enable/disable see-through check box MakeWidget ({ 5, 107}, {WW - 10, 60}, WindowWidgetType::Groupbox, WindowColour::Primary, STR_VIEW_CLIPPING_HORIZONTAL_CLIPPING ), MakeWidget ({ 11, 122}, { 158, 17}, WindowWidgetType::Button, WindowColour::Primary, STR_VIEW_CLIPPING_SELECT_AREA ), // selector - MakeWidget ({ 11, 143}, { 158, 18}, WindowWidgetType::Button, WindowColour::Primary, STR_VIEW_CLIPPING_CLEAR_SELECTION ), // clear - }; + MakeWidget ({ 11, 143}, { 158, 18}, WindowWidgetType::Button, WindowColour::Primary, STR_VIEW_CLIPPING_CLEAR_SELECTION ) // clear + ); // clang-format on #pragma endregion diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 97d59029cb..80de168f8d 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -44,16 +44,15 @@ namespace OpenRCT2::Ui::Windows #pragma endregion // clang-format off - static constexpr Widget _viewportWidgets[] = - { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _viewportWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget({ 0, 14}, { WW - 1, WH - 1}, WindowWidgetType::Resize, WindowColour::Secondary ), // resize MakeWidget({ 3, 17}, {WW - 26, WH - 3}, WindowWidgetType::Viewport, WindowColour::Primary ), // viewport MakeWidget({WW - 25, 17}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_G2_ZOOM_IN), STR_ZOOM_IN_TIP ), // zoom in MakeWidget({WW - 25, 41}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_G2_ZOOM_OUT), STR_ZOOM_OUT_TIP ), // zoom out MakeWidget({WW - 25, 65}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // locate - MakeWidget({WW - 25, 89}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_ROTATE_ARROW),STR_LOCATE_SUBJECT_TIP), // rotate - }; + MakeWidget({WW - 25, 89}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_ROTATE_ARROW),STR_LOCATE_SUBJECT_TIP) // rotate + ); // clang-format on class ViewportWindow final : public Window diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 02368c1822..ac6f2f6876 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -40,12 +40,12 @@ namespace OpenRCT2::Ui::Windows }; // clang-format off - static constexpr Widget _waterWidgets[] = { - WINDOW_SHIM(WINDOW_TITLE, WW, WH), + static constexpr auto _waterWidgets = makeWidgets( + makeWindowShim(WINDOW_TITLE, WW, WH), MakeWidget ({16, 17}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0), kStringIdNone), // preview box MakeRemapWidget({17, 18}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_WATER_TIP), // decrement size - MakeRemapWidget({43, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_WATER_TIP), // increment size - }; + MakeRemapWidget({43, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_WATER_TIP) // increment size + ); // clang-format on class WaterWindow final : public Window