mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Add theme features to draw border around image buttons
This commit is contained in:
@@ -3844,3 +3844,4 @@ STR_7002 :{STRINGID} {STRINGID}
|
||||
STR_7003 :Audio file ‘{STRING}’ is truncated. Expected sample {INT32}, but only {INT32} are available. Consider reinstalling RCT2.
|
||||
STR_7004 :Force Redraw
|
||||
STR_7005 :Drag an area of footpath
|
||||
STR_7006 :Draw border around image buttons
|
||||
|
||||
@@ -1972,6 +1972,7 @@ namespace OpenRCT2
|
||||
STR_THEMES_OPTION_RCT1_PARK_CONTROLS = 5283,
|
||||
STR_THEMES_OPTION_RCT1_RIDE_CONTROLS = 5282,
|
||||
STR_THEMES_OPTION_RCT1_SCENARIO_SELECTION_FONT = 5284,
|
||||
STR_THEMES_OPTION_USE_3D_IMAGE_BUTTONS = 7006,
|
||||
STR_THEMES_PROMPT_ENTER_THEME_NAME = 5240,
|
||||
STR_THEMES_TAB_EDITORS_TIP = 5232,
|
||||
STR_THEMES_TAB_FEATURES_TIP = 5281,
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace OpenRCT2::Ui
|
||||
const UITheme kPredefinedThemeRCT1 = UITheme::CreatePredefined(
|
||||
"*RCT1", kPredefinedThemeRCT1Entries,
|
||||
UITHEME_FLAG_USE_LIGHTS_RIDE | UITHEME_FLAG_USE_LIGHTS_PARK | UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT
|
||||
| UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR);
|
||||
| UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR | UITHEME_FLAG_USE_3D_IMAGE_BUTTONS);
|
||||
|
||||
const UITheme kPredefinedThemeRCT2 = UITheme::CreatePredefined("*RCT2", kPredefinedThemeRCT2Entries, 0);
|
||||
|
||||
@@ -441,6 +441,7 @@ namespace OpenRCT2::Ui
|
||||
{ "useLightsPark", (Flags & UITHEME_FLAG_USE_LIGHTS_PARK) != 0 },
|
||||
{ "useAltScenarioSelectFont", (Flags & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) != 0 },
|
||||
{ "useFullBottomToolbar", (Flags & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) != 0 },
|
||||
{ "use3dImageButtons", (Flags & UITHEME_FLAG_USE_3D_IMAGE_BUTTONS) != 0 },
|
||||
};
|
||||
|
||||
return jsonTheme;
|
||||
@@ -489,6 +490,7 @@ namespace OpenRCT2::Ui
|
||||
{ "useLightsPark", UITHEME_FLAG_USE_LIGHTS_PARK },
|
||||
{ "useAltScenarioSelectFont", UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT },
|
||||
{ "useFullBottomToolbar", UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR },
|
||||
{ "use3dImageButtons", UITHEME_FLAG_USE_3D_IMAGE_BUTTONS },
|
||||
});
|
||||
|
||||
if (jsonEntries.is_object())
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace OpenRCT2::Ui
|
||||
UITHEME_FLAG_USE_LIGHTS_PARK = 1 << 2,
|
||||
UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT = 1 << 3,
|
||||
UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR = 1 << 4,
|
||||
UITHEME_FLAG_USE_3D_IMAGE_BUTTONS = 1 << 5,
|
||||
};
|
||||
|
||||
void ColourSchemeUpdate(WindowBase* window);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <openrct2-ui/UiStringIds.h>
|
||||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/Game.h>
|
||||
@@ -270,7 +271,8 @@ namespace OpenRCT2::Ui
|
||||
*/
|
||||
static void WidgetFlatButtonDraw(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex)
|
||||
{
|
||||
if (!widgetIsDisabled(w, widgetIndex) && widgetIsHighlighted(w, widgetIndex))
|
||||
const bool alwaysDrawAs3d = (ThemeGetFlags() & UITHEME_FLAG_USE_3D_IMAGE_BUTTONS);
|
||||
if (alwaysDrawAs3d || (!widgetIsDisabled(w, widgetIndex) && widgetIsHighlighted(w, widgetIndex)))
|
||||
{
|
||||
WidgetButtonDraw(rt, w, widgetIndex);
|
||||
return;
|
||||
|
||||
@@ -67,7 +67,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_THEMES_RCT1_RIDE_LIGHTS,
|
||||
WIDX_THEMES_RCT1_PARK_LIGHTS,
|
||||
WIDX_THEMES_RCT1_SCENARIO_FONT,
|
||||
WIDX_THEMES_RCT1_BOTTOM_TOOLBAR
|
||||
WIDX_THEMES_RCT1_BOTTOM_TOOLBAR,
|
||||
WIDX_THEMES_USE_3D_IMAGE_BUTTONS,
|
||||
};
|
||||
|
||||
static constexpr StringId kWindowTitle = STR_THEMES_TITLE;
|
||||
@@ -101,7 +102,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
makeWidget({ 10, 54}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_RIDE_CONTROLS ), // rct1 ride lights
|
||||
makeWidget({ 10, 69}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_PARK_CONTROLS ), // rct1 park lights
|
||||
makeWidget({ 10, 84}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_SCENARIO_SELECTION_FONT ), // rct1 scenario font
|
||||
makeWidget({ 10, 99}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR ) // rct1 bottom toolbar
|
||||
makeWidget({ 10, 99}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR ), // rct1 bottom toolbar
|
||||
makeWidget({ 10,114}, {290, 12}, WidgetType::checkbox, WindowColour::secondary, STR_THEMES_OPTION_USE_3D_IMAGE_BUTTONS ) // use 3D image buttons
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
@@ -281,7 +283,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
else if (_selectedTab == WINDOW_THEMES_TAB_FEATURES)
|
||||
{
|
||||
if (WindowSetResize(*this, { 320, 122 }, { 320, 122 }))
|
||||
if (WindowSetResize(*this, { 320, 137 }, { 320, 137 }))
|
||||
GfxInvalidateScreen();
|
||||
}
|
||||
else
|
||||
@@ -329,6 +331,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_USE_3D_IMAGE_BUTTONS].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WidgetType::button;
|
||||
widgets[WIDX_THEMES_DELETE_BUTTON].type = WidgetType::button;
|
||||
widgets[WIDX_THEMES_RENAME_BUTTON].type = WidgetType::button;
|
||||
@@ -346,6 +349,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WidgetType::checkbox;
|
||||
widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WidgetType::checkbox;
|
||||
widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WidgetType::checkbox;
|
||||
widgets[WIDX_THEMES_USE_3D_IMAGE_BUTTONS].type = WidgetType::checkbox;
|
||||
widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_DELETE_BUTTON].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_RENAME_BUTTON].type = WidgetType::empty;
|
||||
@@ -358,6 +362,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
setCheckboxValue(
|
||||
WIDX_THEMES_RCT1_SCENARIO_FONT, ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT);
|
||||
setCheckboxValue(WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR);
|
||||
setCheckboxValue(WIDX_THEMES_USE_3D_IMAGE_BUTTONS, ThemeGetFlags() & UITHEME_FLAG_USE_3D_IMAGE_BUTTONS);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -369,6 +374,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_THEMES_RCT1_PARK_LIGHTS].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_RCT1_SCENARIO_FONT].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_RCT1_BOTTOM_TOOLBAR].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_USE_3D_IMAGE_BUTTONS].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_DUPLICATE_BUTTON].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_DELETE_BUTTON].type = WidgetType::empty;
|
||||
widgets[WIDX_THEMES_RENAME_BUTTON].type = WidgetType::empty;
|
||||
@@ -497,6 +503,19 @@ namespace OpenRCT2::Ui::Windows
|
||||
ThemeSave();
|
||||
windowMgr->InvalidateAll();
|
||||
}
|
||||
break;
|
||||
case WIDX_THEMES_USE_3D_IMAGE_BUTTONS:
|
||||
if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeSetFlags(ThemeGetFlags() ^ static_cast<uint8_t>(UITHEME_FLAG_USE_3D_IMAGE_BUTTONS));
|
||||
ThemeSave();
|
||||
windowMgr->InvalidateAll();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user