mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
WIP: Make title bar bigger in Enlarged UI mode
This commit is contained in:
committed by
Aaron van Geffen
parent
76cc04d044
commit
8d1bb273d8
@@ -840,6 +840,8 @@ public:
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
uint32_t flags) override
|
||||
{
|
||||
// auto titleBarHeight = (flags & WF_NO_TITLE_BAR) ? 0 : GetTitleBarHeight();
|
||||
|
||||
if (flags & WF_AUTO_POSITION)
|
||||
{
|
||||
if (flags & WF_CENTRE_SCREEN)
|
||||
|
||||
@@ -568,6 +568,8 @@ namespace OpenRCT2::Ui
|
||||
topLeft.x += width / 2;
|
||||
if (Config::Get().interface.WindowButtonsOnTheLeft)
|
||||
topLeft.x += kCloseButtonSize;
|
||||
if (Config::Get().interface.EnlargedUi)
|
||||
topLeft.y += 6;
|
||||
|
||||
DrawTextEllipsised(
|
||||
dpi, topLeft, width, widget->text, Formatter::Common(),
|
||||
|
||||
@@ -470,32 +470,55 @@ namespace OpenRCT2
|
||||
this, callWidget, title, description, descriptionArgs, existingText, existingArgs, maxLength);
|
||||
}
|
||||
|
||||
void Window::ResizeFrame()
|
||||
int32_t Window::ResizeFrame()
|
||||
{
|
||||
// Frame
|
||||
widgets[0].right = width - 1;
|
||||
widgets[0].bottom = height - 1;
|
||||
|
||||
// Title
|
||||
widgets[1].right = width - 2;
|
||||
|
||||
// Close button
|
||||
auto closeButtonSize = Config::Get().interface.EnlargedUi ? kCloseButtonSizeTouch : kCloseButtonSize;
|
||||
if (Config::Get().interface.WindowButtonsOnTheLeft)
|
||||
{
|
||||
widgets[2].left = 2;
|
||||
widgets[2].right = 2 + kCloseButtonSize;
|
||||
widgets[2].right = 2 + closeButtonSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
widgets[2].left = width - 3 - kCloseButtonSize;
|
||||
widgets[2].left = width - 3 - closeButtonSize;
|
||||
widgets[2].right = width - 3;
|
||||
}
|
||||
|
||||
auto defaultHeight = OpenRCT2::Ui::Windows::GetTitleBarHeight();
|
||||
auto currentHeight = widgets[1].height();
|
||||
auto heightDifference = defaultHeight - currentHeight;
|
||||
if (heightDifference != 0)
|
||||
{
|
||||
widgets[1].bottom += heightDifference;
|
||||
widgets[2].bottom += heightDifference;
|
||||
|
||||
for (size_t i = 3; i < widgets.size(); i++)
|
||||
{
|
||||
widgets[i].top += heightDifference;
|
||||
widgets[i].bottom += heightDifference;
|
||||
}
|
||||
}
|
||||
|
||||
return heightDifference;
|
||||
}
|
||||
|
||||
void Window::ResizeFrameWithPage()
|
||||
int32_t Window::ResizeFrameWithPage()
|
||||
{
|
||||
ResizeFrame();
|
||||
// Page background
|
||||
widgets[3].right = width - 1;
|
||||
widgets[3].bottom = height - 1;
|
||||
auto heightDifference = ResizeFrame();
|
||||
|
||||
constexpr auto pageBackgroundOffset = 3;
|
||||
widgets[pageBackgroundOffset].right = width - 1;
|
||||
widgets[pageBackgroundOffset].bottom = height - 1;
|
||||
|
||||
return heightDifference;
|
||||
}
|
||||
|
||||
void Window::ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size)
|
||||
@@ -1136,4 +1159,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowZoomOut(*mainWindow, atCursor);
|
||||
}
|
||||
|
||||
int16_t GetTitleBarHeight()
|
||||
{
|
||||
return Config::Get().interface.EnlargedUi ? 24 : 12;
|
||||
}
|
||||
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
||||
@@ -40,8 +40,8 @@ namespace OpenRCT2
|
||||
WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs,
|
||||
StringId existingText, uintptr_t existingArgs, int32_t maxLength);
|
||||
|
||||
void ResizeFrame();
|
||||
void ResizeFrameWithPage();
|
||||
int32_t ResizeFrame();
|
||||
int32_t ResizeFrameWithPage();
|
||||
|
||||
void ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
|
||||
void ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
|
||||
@@ -91,4 +91,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
void WindowZoomIn(WindowBase& w, bool atCursor);
|
||||
void WindowZoomOut(WindowBase& w, bool atCursor);
|
||||
void MainWindowZoom(bool zoomIn, bool atCursor);
|
||||
|
||||
int16_t GetTitleBarHeight();
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
||||
@@ -152,6 +152,7 @@ namespace OpenRCT2
|
||||
};
|
||||
|
||||
constexpr uint8_t kCloseButtonSize = 10;
|
||||
constexpr uint8_t kCloseButtonSizeTouch = 20;
|
||||
|
||||
constexpr int32_t kScrollableRowHeight = 12;
|
||||
constexpr uint8_t kListRowHeight = 12;
|
||||
|
||||
Reference in New Issue
Block a user