forked from rosebudai/OpenRCT2-Web
Merge pull request #23886 from AaronVanGeffen/touch-mode-backports
Touch mode backports
This commit is contained in:
40 files changed
+166
-141
No files matched your search
@@ -1177,10 +1177,7 @@ namespace OpenRCT2
|
||||
|
||||
case WindowWidgetType::Frame:
|
||||
case WindowWidgetType::Resize:
|
||||
if (!(window->flags & WF_RESIZABLE))
|
||||
break;
|
||||
|
||||
if (window->min_width == window->max_width && window->min_height == window->max_height)
|
||||
if (!window->canBeResized())
|
||||
break;
|
||||
|
||||
if (screenCoords.x < window->windowPos.x + window->width - 0x13)
|
||||
|
||||
@@ -145,10 +145,7 @@ namespace OpenRCT2::Ui
|
||||
// Draw the frame
|
||||
GfxFillRectInset(dpi, { leftTop, { r, b } }, colour, press);
|
||||
|
||||
// Check if the window can be resized
|
||||
if (!(w.flags & WF_RESIZABLE))
|
||||
return;
|
||||
if (w.min_width == w.max_width && w.min_height == w.max_height)
|
||||
if (!w.canBeResized())
|
||||
return;
|
||||
|
||||
// Draw the resize sprite at the bottom right corner
|
||||
@@ -175,10 +172,7 @@ namespace OpenRCT2::Ui
|
||||
// Draw the panel
|
||||
GfxFillRectInset(dpi, { leftTop, { r, b } }, colour, 0);
|
||||
|
||||
// Check if the window can be resized
|
||||
if (!(w.flags & WF_RESIZABLE))
|
||||
return;
|
||||
if (w.min_width == w.max_width && w.min_height == w.max_height)
|
||||
if (!w.canBeResized())
|
||||
return;
|
||||
|
||||
// Draw the resize sprite at the bottom right corner
|
||||
@@ -568,13 +562,13 @@ namespace OpenRCT2::Ui
|
||||
int32_t width = widget->width() - 4;
|
||||
if ((widget + 1)->type == WindowWidgetType::CloseBox)
|
||||
{
|
||||
width -= kCloseButtonWidth;
|
||||
width -= kCloseButtonSize;
|
||||
if ((widget + 2)->type == WindowWidgetType::CloseBox)
|
||||
width -= kCloseButtonWidth;
|
||||
width -= kCloseButtonSize;
|
||||
}
|
||||
topLeft.x += width / 2;
|
||||
if (Config::Get().interface.WindowButtonsOnTheLeft)
|
||||
topLeft.x += kCloseButtonWidth;
|
||||
topLeft.x += kCloseButtonSize;
|
||||
|
||||
DrawTextEllipsised(
|
||||
dpi, topLeft, width, widget->text, Formatter::Common(),
|
||||
|
||||
@@ -481,11 +481,11 @@ namespace OpenRCT2
|
||||
if (Config::Get().interface.WindowButtonsOnTheLeft)
|
||||
{
|
||||
widgets[2].left = 2;
|
||||
widgets[2].right = 2 + kCloseButtonWidth;
|
||||
widgets[2].right = 2 + kCloseButtonSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
widgets[2].left = width - 3 - kCloseButtonWidth;
|
||||
widgets[2].left = width - 3 - kCloseButtonSize;
|
||||
widgets[2].right = width - 3;
|
||||
}
|
||||
}
|
||||
@@ -564,7 +564,7 @@ namespace OpenRCT2
|
||||
|
||||
ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w)
|
||||
{
|
||||
const uint8_t buttonOffset = (Config::Get().interface.WindowButtonsOnTheLeft) ? kCloseButtonWidth + 2 : 0;
|
||||
const uint8_t buttonOffset = (Config::Get().interface.WindowButtonsOnTheLeft) ? kCloseButtonSize + 2 : 0;
|
||||
return w.windowPos + ScreenCoordsXY{ 2 + buttonOffset, 2 };
|
||||
}
|
||||
} // namespace OpenRCT2
|
||||
|
||||
@@ -492,9 +492,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Having the content panel visible for transparent windows makes the borders darker than they should be
|
||||
// For now just hide it if there are no tabs and the window is not resizable
|
||||
auto canResize = (flags & WF_RESIZABLE) != 0 && (min_width != max_width || min_height != max_height);
|
||||
auto numTabs = _info.Desc.Tabs.size();
|
||||
if (canResize || numTabs != 0)
|
||||
if (canBeResized() || numTabs != 0)
|
||||
{
|
||||
widgets[WIDX_CONTENT_PANEL].flags &= ~WIDGET_FLAGS::IS_HIDDEN;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto& list = widgets[WIDX_LIST];
|
||||
list.left = 6;
|
||||
list.top = 20 + 11 + 3;
|
||||
list.top = widgets[WIDX_TITLE].height() + 8 + 11 + 3;
|
||||
list.right = width - 2 - 24 - 1;
|
||||
list.bottom = height - 6 - 11 - 3;
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_LOW_LABEL].left = list.left;
|
||||
widgets[WIDX_LOW_LABEL].right = list.right;
|
||||
|
||||
auto toolstripY = 20;
|
||||
auto toolstripY = widgets[WIDX_TITLE].height() + 8;
|
||||
auto toolstripRight = width - 2;
|
||||
auto toolstripLeft = toolstripRight - 24;
|
||||
for (WidgetIndex i = WIDX_MOVE_UP; i <= WIDX_APPLY; i++)
|
||||
|
||||
@@ -279,6 +279,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ResizeFrame();
|
||||
|
||||
Widget& colourBtn = widgets[WIDX_MAIN_COLOUR];
|
||||
colourBtn.type = WindowWidgetType::Empty;
|
||||
|
||||
|
||||
@@ -755,8 +755,7 @@ static StringId window_cheats_page_titles[] = {
|
||||
Invalidate();
|
||||
WindowInitScrollWidgets(*this);
|
||||
height = maxY;
|
||||
widgets[WIDX_BACKGROUND].bottom = maxY - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].bottom = maxY - 1;
|
||||
ResizeFrameWithPage();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
DrawWidgets(dpi);
|
||||
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 10, 30 };
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 10, 18 + widgets[WIDX_TITLE].height() };
|
||||
|
||||
DrawTextBasic(dpi, screenCoords, STR_RATE, {}, { colours[1] });
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<DebugPaintWindow>(
|
||||
WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Create the window (width/height position are set later)
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<DropdownWindow>(WindowClass::Dropdown, width, customItemHeight, WF_STICK_TO_FRONT);
|
||||
auto* w = windowMgr->Create<DropdownWindow>(
|
||||
WindowClass::Dropdown, width, customItemHeight, WF_STICK_TO_FRONT | WF_NO_TITLE_BAR);
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto numRowsPerColumn = prefRowsPerColumn > 0 ? static_cast<int32_t>(prefRowsPerColumn) : Dropdown::kItemsMaxSize;
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<EditorBottomToolbarWindow>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -930,14 +930,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_FILTER_RIDE_TAB_FRAME].right = widgets[WIDX_LIST].right;
|
||||
|
||||
widgets[WIDX_FILTER_TEXT_BOX].right = widgets[WIDX_LIST].right - 77;
|
||||
widgets[WIDX_FILTER_TEXT_BOX].top = (hasSubTabs ? 79 : 48);
|
||||
widgets[WIDX_FILTER_TEXT_BOX].bottom = (hasSubTabs ? 92 : 61);
|
||||
auto contentStart = widgets[WIDX_TAB_CONTENT_PANEL].top;
|
||||
widgets[WIDX_FILTER_TEXT_BOX].moveToY(contentStart + (hasSubTabs ? 36 : 5));
|
||||
widgets[WIDX_FILTER_TEXT_BOX].string = _filter.data();
|
||||
|
||||
widgets[WIDX_FILTER_CLEAR_BUTTON].left = widgets[WIDX_LIST].right - 73;
|
||||
widgets[WIDX_FILTER_CLEAR_BUTTON].right = widgets[WIDX_LIST].right;
|
||||
widgets[WIDX_FILTER_CLEAR_BUTTON].top = (hasSubTabs ? 79 : 48);
|
||||
widgets[WIDX_FILTER_CLEAR_BUTTON].bottom = (hasSubTabs ? 92 : 61);
|
||||
widgets[WIDX_FILTER_CLEAR_BUTTON].moveToY(contentStart + (hasSubTabs ? 36 : 5));
|
||||
|
||||
// Toggle sub-tab visibility
|
||||
const auto numSubTabs = static_cast<int8_t>(currentPage.subTabs.size());
|
||||
|
||||
@@ -142,7 +142,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto errorWindow = std::make_unique<ErrorWindow>(std::move(buffer), numLines, autoClose);
|
||||
|
||||
return windowMgr->Create(
|
||||
std::move(errorWindow), WindowClass::Error, windowPosition, width, height, WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
std::move(errorWindow), WindowClass::Error, windowPosition, width, height,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
|
||||
WindowBase* ErrorOpen(StringId title, StringId message, const Formatter& args, bool autoClose)
|
||||
|
||||
@@ -82,9 +82,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
#pragma region Measurements
|
||||
|
||||
static constexpr int32_t WH_SUMMARY = 309;
|
||||
static constexpr int32_t WH_RESEARCH = 207;
|
||||
static constexpr int32_t WH_OTHER_TABS = 257;
|
||||
static constexpr int32_t kCostPerWeekOffset = 321;
|
||||
static constexpr int32_t kHeightSummary = 309;
|
||||
static constexpr int32_t kHeightResearch = 207;
|
||||
static constexpr int32_t kHeightOtherTabs = 257;
|
||||
static constexpr int32_t WW_RESEARCH = 320;
|
||||
static constexpr int32_t WW_OTHER_TABS = 530;
|
||||
static constexpr int32_t RSH_SUMMARY = 266;
|
||||
@@ -110,29 +111,29 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
static constexpr Widget _windowFinancesSummaryWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_FINANCIAL_SUMMARY, RSW_OTHER_TABS, RSH_SUMMARY, WW_OTHER_TABS, WH_SUMMARY),
|
||||
MAIN_FINANCES_WIDGETS(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.
|
||||
};
|
||||
|
||||
static constexpr Widget _windowFinancesCashWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_FINANCIAL_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS),
|
||||
MAIN_FINANCES_WIDGETS(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, WH_OTHER_TABS),
|
||||
MAIN_FINANCES_WIDGETS(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, WH_OTHER_TABS),
|
||||
MAIN_FINANCES_WIDGETS(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, WH_OTHER_TABS),
|
||||
MAIN_FINANCES_WIDGETS(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),
|
||||
@@ -145,7 +146,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
static constexpr Widget _windowFinancesResearchWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_RESEARCH_FUNDING, RSW_RESEARCH, RSH_RESEARCH, WW_RESEARCH, WH_RESEARCH),
|
||||
MAIN_FINANCES_WIDGETS(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),
|
||||
@@ -493,13 +494,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (p == WINDOW_FINANCES_PAGE_RESEARCH)
|
||||
{
|
||||
width = WW_RESEARCH;
|
||||
height = WH_RESEARCH;
|
||||
height = kHeightResearch;
|
||||
flags &= ~WF_RESIZABLE;
|
||||
}
|
||||
else if (p == WINDOW_FINANCES_PAGE_SUMMARY)
|
||||
{
|
||||
width = WW_OTHER_TABS;
|
||||
height = WH_SUMMARY;
|
||||
height = kHeightSummary;
|
||||
flags &= ~WF_RESIZABLE;
|
||||
}
|
||||
else if (
|
||||
@@ -508,13 +509,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
flags |= WF_RESIZABLE;
|
||||
WindowSetResize(
|
||||
*this, WW_OTHER_TABS, WH_OTHER_TABS, std::numeric_limits<int16_t>::max(),
|
||||
*this, WW_OTHER_TABS, kHeightOtherTabs, std::numeric_limits<int16_t>::max(),
|
||||
std::numeric_limits<int16_t>::max());
|
||||
}
|
||||
else
|
||||
{
|
||||
width = WW_OTHER_TABS;
|
||||
height = WH_OTHER_TABS;
|
||||
height = kHeightOtherTabs;
|
||||
flags &= ~WF_RESIZABLE;
|
||||
}
|
||||
OnResize();
|
||||
@@ -584,7 +585,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnDrawSummary(DrawPixelInfo& dpi)
|
||||
{
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 8, 51 };
|
||||
auto titleBarBottom = widgets[WIDX_TITLE].bottom;
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 8, titleBarBottom + 37 };
|
||||
auto& gameState = GetGameState();
|
||||
|
||||
// Expenditure / Income heading
|
||||
@@ -609,23 +611,26 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Horizontal rule below expenditure / income table
|
||||
GfxFillRectInset(
|
||||
dpi, { windowPos + ScreenCoordsXY{ 8, 272 }, windowPos + ScreenCoordsXY{ 8 + 513, 272 + 1 } }, colours[1],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
dpi,
|
||||
{ windowPos + ScreenCoordsXY{ 8, titleBarBottom + 258 },
|
||||
windowPos + ScreenCoordsXY{ 8 + 513, titleBarBottom + 258 + 1 } },
|
||||
colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
// Loan and interest rate
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 279 }, STR_FINANCES_SUMMARY_LOAN);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_LOAN);
|
||||
if (!(gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST))
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(gameState.BankLoanInterestRate);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 167, 279 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft);
|
||||
DrawTextBasic(
|
||||
dpi, windowPos + ScreenCoordsXY{ 167, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft);
|
||||
}
|
||||
|
||||
// Current cash
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(gameState.Cash);
|
||||
StringId stringId = gameState.Cash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL;
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 294 }, stringId, ft);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 280 }, stringId, ft);
|
||||
|
||||
// Objective related financial information
|
||||
if (gameState.ScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME)
|
||||
@@ -634,18 +639,18 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft = Formatter();
|
||||
ft.Add<money64>(lastMonthProfit);
|
||||
DrawTextBasic(
|
||||
dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL,
|
||||
ft);
|
||||
dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 265 },
|
||||
STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Park value and company value
|
||||
ft = Formatter();
|
||||
ft.Add<money64>(gameState.Park.Value);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 265 }, STR_PARK_VALUE_LABEL, ft);
|
||||
ft = Formatter();
|
||||
ft.Add<money64>(gameState.CompanyValue);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, ft);
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 280 }, STR_COMPANY_VALUE_LABEL, ft);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,7 +703,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnDrawMarketing(DrawPixelInfo& dpi)
|
||||
{
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 8, 62 };
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_TAB_1].top + 45 };
|
||||
int32_t noCampaignsActive = 1;
|
||||
for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++)
|
||||
{
|
||||
@@ -753,9 +758,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (noCampaignsActive)
|
||||
{
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, STR_MARKETING_CAMPAIGNS_NONE);
|
||||
screenCoords.y += kListRowHeight;
|
||||
}
|
||||
screenCoords.y += 34;
|
||||
|
||||
// Draw campaign button text
|
||||
for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++)
|
||||
@@ -764,12 +767,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (campaignButton->type != WindowWidgetType::Empty)
|
||||
{
|
||||
// Draw button text
|
||||
screenCoords = windowPos + ScreenCoordsXY{ campaignButton->left, campaignButton->textTop() };
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, kMarketingCampaignNames[i][0]);
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(AdvertisingCampaignPricePerWeek[i]);
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ WH_SUMMARY, 0 }, STR_MARKETING_PER_WEEK, ft);
|
||||
|
||||
screenCoords.y += kButtonFaceHeight + 2;
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ kCostPerWeekOffset, 0 }, STR_MARKETING_PER_WEEK, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -880,7 +882,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static FinancesWindow* FinancesWindowOpen(uint8_t page)
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
auto* window = windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, kHeightSummary, WF_10);
|
||||
|
||||
if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY)
|
||||
window->SetPage(page);
|
||||
@@ -891,7 +893,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* FinancesOpen()
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
return windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, kHeightSummary, WF_10);
|
||||
}
|
||||
|
||||
WindowBase* FinancesResearchOpen()
|
||||
|
||||
@@ -693,7 +693,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<GameBottomToolbar>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, screenHeight - toolbar_height), screenWidth, toolbar_height,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -601,8 +601,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
if (viewport != nullptr)
|
||||
{
|
||||
auto reqViewportWidth = width - 30;
|
||||
auto reqViewportHeight = height - 72;
|
||||
auto widget = widgets[WIDX_VIEWPORT];
|
||||
auto reqViewportWidth = widget.width() - 1;
|
||||
auto reqViewportHeight = widget.height() - 1;
|
||||
viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
|
||||
if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight)
|
||||
{
|
||||
viewport->width = reqViewportWidth;
|
||||
|
||||
@@ -78,6 +78,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<MainWindow>(
|
||||
WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK);
|
||||
WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK | WF_NO_TITLE_BAR);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -376,7 +376,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
dpi, windowPos + ScreenCoordsXY{ spinnerWidget->left + 1, spinnerWidget->top },
|
||||
Campaign.no_weeks == 1 ? STR_MARKETING_1_WEEK : STR_X_WEEKS, ft, { colours[0] });
|
||||
|
||||
screenCoords = windowPos + ScreenCoordsXY{ 14, 60 };
|
||||
screenCoords = windowPos + ScreenCoordsXY{ 14, spinnerWidget->bottom + 6 };
|
||||
|
||||
// Price per week
|
||||
ft = Formatter();
|
||||
|
||||
@@ -43,7 +43,8 @@ using namespace OpenRCT2::TrackMetaData;
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
static constexpr StringId WindowTitle = kStringIdNone;
|
||||
static constexpr int32_t WindowHeight = 382;
|
||||
static constexpr int32_t kWindowHeight = 382;
|
||||
static constexpr int32_t kWindowHeightResearch = 194;
|
||||
static constexpr int32_t WindowWidth = 601;
|
||||
static constexpr int32_t RideListItemsMax = 384;
|
||||
static constexpr int32_t RideTabCount = 6;
|
||||
@@ -209,7 +210,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// clang-format off
|
||||
static constexpr Widget window_new_ride_widgets[] = {
|
||||
WINDOW_SHIM(WindowTitle, WindowWidth, WindowHeight),
|
||||
WINDOW_SHIM(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 ),
|
||||
@@ -837,7 +838,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::Empty;
|
||||
|
||||
newWidth = WindowWidth;
|
||||
newHeight = WindowHeight;
|
||||
newHeight = kWindowHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -851,7 +852,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::FlatBtn;
|
||||
|
||||
newWidth = 300;
|
||||
newHeight = 196;
|
||||
newHeight = kWindowHeightResearch;
|
||||
}
|
||||
|
||||
// Handle new window size
|
||||
@@ -1083,7 +1084,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
windowMgr->CloseByClass(WindowClass::TrackDesignPlace);
|
||||
|
||||
window = windowMgr->Create<NewRideWindow>(
|
||||
WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION);
|
||||
WindowClass::ConstructRide, WindowWidth, kWindowHeight, WF_10 | WF_AUTO_POSITION);
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
ResizeFrame();
|
||||
}
|
||||
|
||||
void OnResize() override
|
||||
{
|
||||
ResizeFrame();
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_LAST_DEVELOPMENT_GROUP,
|
||||
WIDX_LAST_DEVELOPMENT_BUTTON,
|
||||
|
||||
WIDX_FUNDING_GROUP = 6,
|
||||
WIDX_RESEARCH_FUNDING_GROUP = 6,
|
||||
WIDX_RESEARCH_FUNDING,
|
||||
WIDX_RESEARCH_FUNDING_DROPDOWN_BUTTON,
|
||||
WIDX_PRIORITIES_GROUP,
|
||||
@@ -591,7 +591,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t currentResearchLevel = gameState.ResearchFundingLevel;
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(research_cost_table[currentResearchLevel]);
|
||||
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 10, 77 }, STR_RESEARCH_COST_PER_MONTH, ft);
|
||||
DrawTextBasic(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ 10, w->widgets[WIDX_TAB_1].top + 60 }, STR_RESEARCH_COST_PER_MONTH, ft);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -79,9 +79,11 @@ using namespace OpenRCT2::TrackMetaData;
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
static constexpr int32_t kMinimumWindowWidth = 316;
|
||||
|
||||
static constexpr StringId WINDOW_TITLE = STR_RIDE_WINDOW_TITLE;
|
||||
static constexpr int32_t WH = 207;
|
||||
static constexpr int32_t WW = 316;
|
||||
static constexpr int32_t WW = kMinimumWindowWidth;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -242,7 +244,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
#define MAIN_RIDE_WIDGETS \
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH), \
|
||||
MakeWidget({ 0, 43 }, { 316, 137 }, WindowWidgetType::Resize, WindowColour::Secondary), \
|
||||
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), \
|
||||
@@ -752,7 +754,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
list_information_type = 0;
|
||||
picked_peep_frame = 0;
|
||||
DisableTabs();
|
||||
min_width = 316;
|
||||
min_width = kMinimumWindowWidth;
|
||||
min_height = 180;
|
||||
max_width = 500;
|
||||
max_height = 450;
|
||||
@@ -1708,7 +1710,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
flags |= WF_RESIZABLE;
|
||||
WindowSetResize(*this, 316, minHeight, 500, 450);
|
||||
WindowSetResize(*this, kMinimumWindowWidth, minHeight, 500, 450);
|
||||
// Unlike with other windows, the focus needs to be recentred so it’s best to just reset it.
|
||||
focus = std::nullopt;
|
||||
InitViewport();
|
||||
@@ -2410,7 +2412,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
: WindowWidgetType::Empty;
|
||||
widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn;
|
||||
|
||||
widgetHeight = 62;
|
||||
widgetHeight = widgets[WIDX_PAGE_BACKGROUND].top + 19;
|
||||
if (widgets[WIDX_SIMULATE_LIGHT].type != WindowWidgetType::Empty)
|
||||
{
|
||||
widgets[WIDX_SIMULATE_LIGHT].top = widgetHeight;
|
||||
@@ -2656,7 +2658,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void VehicleResize()
|
||||
{
|
||||
auto bottom = widgets[WIDX_VEHICLE_TRAINS].bottom + 6;
|
||||
WindowSetResize(*this, 316, bottom, 316, bottom);
|
||||
WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom);
|
||||
}
|
||||
|
||||
void VehicleOnMouseDown(WidgetIndex widgetIndex)
|
||||
@@ -2879,8 +2881,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (rideEntry == nullptr)
|
||||
return;
|
||||
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 8, 64 };
|
||||
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_VEHICLE_TYPE_DROPDOWN].bottom + 5 };
|
||||
// Description
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(rideEntry->naming.Description);
|
||||
@@ -3201,7 +3202,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OperatingResize()
|
||||
{
|
||||
WindowSetResize(*this, 316, 186, 316, 186);
|
||||
auto bottom = widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].bottom + 6;
|
||||
WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom);
|
||||
}
|
||||
|
||||
void OperatingOnMouseDown(WidgetIndex widgetIndex)
|
||||
@@ -3695,10 +3697,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
|
||||
// Horizontal rule between mode settings and depart settings
|
||||
auto ruleStart = widgets[WIDX_LOAD_DROPDOWN].top - 8;
|
||||
GfxFillRectInset(
|
||||
dpi,
|
||||
{ windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, 103 },
|
||||
windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].right - 5, 104 } },
|
||||
{ windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, ruleStart },
|
||||
windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].right - 5, ruleStart + 1 } },
|
||||
colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
// Number of block sections
|
||||
@@ -3706,9 +3709,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(ride->num_block_brakes + ride->num_stations);
|
||||
auto underWidget = ride->mode == RideMode::PoweredLaunchBlockSectioned ? WIDX_MODE_TWEAK : WIDX_MODE;
|
||||
DrawTextBasic(
|
||||
dpi, windowPos + ScreenCoordsXY{ 21, ride->mode == RideMode::PoweredLaunchBlockSectioned ? 89 : 61 },
|
||||
STR_BLOCK_SECTIONS, ft, { COLOUR_BLACK });
|
||||
dpi, windowPos + ScreenCoordsXY{ 21, widgets[underWidget].bottom + 3 }, STR_BLOCK_SECTIONS, ft,
|
||||
{ COLOUR_BLACK });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3769,7 +3773,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void MaintenanceResize()
|
||||
{
|
||||
WindowSetResize(*this, 316, 135, 316, 135);
|
||||
auto bottom = widgets[WIDX_LOCATE_MECHANIC].bottom + 6;
|
||||
WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom);
|
||||
}
|
||||
|
||||
void MaintenanceOnMouseDown(WidgetIndex widgetIndex)
|
||||
@@ -4293,7 +4298,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void ColourResize()
|
||||
{
|
||||
WindowSetResize(*this, 316, 207, 316, 207);
|
||||
auto bottom = widgets[WIDX_VEHICLE_PREVIEW].bottom + 6;
|
||||
WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom);
|
||||
}
|
||||
|
||||
void ColourOnMouseDown(WidgetIndex widgetIndex)
|
||||
@@ -5013,9 +5019,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Expand the window when music is playing
|
||||
auto isMusicActivated = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) != 0;
|
||||
auto minHeight = isMusicActivated ? 214 : 81;
|
||||
auto maxHeight = isMusicActivated ? 450 : 81;
|
||||
WindowSetResize(*this, 316, minHeight, 500, maxHeight);
|
||||
auto standardHeight = widgets[WIDX_MUSIC_DROPDOWN].bottom + 6;
|
||||
auto minHeight = isMusicActivated ? standardHeight + 133 : standardHeight;
|
||||
auto maxHeight = isMusicActivated ? standardHeight + 369 : standardHeight;
|
||||
WindowSetResize(*this, kMinimumWindowWidth, minHeight, 500, maxHeight);
|
||||
}
|
||||
|
||||
static std::string GetMusicString(ObjectEntryIndex musicObjectIndex)
|
||||
@@ -5456,7 +5463,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void MeasurementsResize()
|
||||
{
|
||||
WindowSetResize(*this, 316, 234, 316, 234);
|
||||
WindowSetResize(*this, kMinimumWindowWidth, 234, kMinimumWindowWidth, 234);
|
||||
}
|
||||
|
||||
void MeasurementsOnMouseDown(WidgetIndex widgetIndex)
|
||||
@@ -5892,7 +5899,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void GraphsResize()
|
||||
{
|
||||
WindowSetResize(*this, 316, 182, std::numeric_limits<int16_t>::max(), 450);
|
||||
WindowSetResize(*this, kMinimumWindowWidth, 182, std::numeric_limits<int16_t>::max(), 450);
|
||||
}
|
||||
|
||||
void GraphsOnMouseDown(WidgetIndex widgetIndex)
|
||||
@@ -6444,7 +6451,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void IncomeResize()
|
||||
{
|
||||
WindowSetResize(*this, 316, 194, 316, 194);
|
||||
auto newHeight = 194;
|
||||
WindowSetResize(*this, kMinimumWindowWidth, newHeight, kMinimumWindowWidth, newHeight);
|
||||
}
|
||||
|
||||
void IncomeOnMouseDown(WidgetIndex widgetIndex)
|
||||
@@ -6760,7 +6768,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void CustomerResize()
|
||||
{
|
||||
flags |= WF_RESIZABLE;
|
||||
WindowSetResize(*this, 316, 163, 316, 163);
|
||||
WindowSetResize(*this, kMinimumWindowWidth, 163, kMinimumWindowWidth, 163);
|
||||
}
|
||||
|
||||
void CustomerUpdate()
|
||||
@@ -6940,7 +6948,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static RideWindow* WindowRideOpen(const Ride& ride)
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<RideWindow>(WindowClass::Ride, 316, 207, WF_10 | WF_RESIZABLE, ride);
|
||||
return windowMgr->Create<RideWindow>(WindowClass::Ride, kMinimumWindowWidth, 207, WF_10 | WF_RESIZABLE, ride);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1887,25 +1887,27 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
auto top = 118 + widgets[WIDX_TITLE].bottom;
|
||||
auto bottom = top + 23;
|
||||
widgets[WIDX_BANKING_GROUPBOX].image = ImageId(STR_RIDE_CONSTRUCTION_ROLL_BANKING);
|
||||
widgets[WIDX_BANK_LEFT].image = ImageId(SPR_RIDE_CONSTRUCTION_LEFT_BANK);
|
||||
widgets[WIDX_BANK_LEFT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_LEFT_CURVE_TIP;
|
||||
widgets[WIDX_BANK_LEFT].left = 69;
|
||||
widgets[WIDX_BANK_LEFT].right = 92;
|
||||
widgets[WIDX_BANK_LEFT].top = 132;
|
||||
widgets[WIDX_BANK_LEFT].bottom = 155;
|
||||
widgets[WIDX_BANK_LEFT].top = top;
|
||||
widgets[WIDX_BANK_LEFT].bottom = bottom;
|
||||
widgets[WIDX_BANK_STRAIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_NO_BANK);
|
||||
widgets[WIDX_BANK_STRAIGHT].tooltip = STR_RIDE_CONSTRUCTION_NO_ROLL_TIP;
|
||||
widgets[WIDX_BANK_STRAIGHT].left = 93;
|
||||
widgets[WIDX_BANK_STRAIGHT].right = 116;
|
||||
widgets[WIDX_BANK_STRAIGHT].top = 132;
|
||||
widgets[WIDX_BANK_STRAIGHT].bottom = 155;
|
||||
widgets[WIDX_BANK_STRAIGHT].top = top;
|
||||
widgets[WIDX_BANK_STRAIGHT].bottom = bottom;
|
||||
widgets[WIDX_BANK_RIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_RIGHT_BANK);
|
||||
widgets[WIDX_BANK_RIGHT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_RIGHT_CURVE_TIP;
|
||||
widgets[WIDX_BANK_RIGHT].left = 117;
|
||||
widgets[WIDX_BANK_RIGHT].right = 140;
|
||||
widgets[WIDX_BANK_RIGHT].top = 132;
|
||||
widgets[WIDX_BANK_RIGHT].bottom = 155;
|
||||
widgets[WIDX_BANK_RIGHT].top = top;
|
||||
widgets[WIDX_BANK_RIGHT].bottom = bottom;
|
||||
widgets[WIDX_BANK_LEFT].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_BANK_STRAIGHT].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_BANK_RIGHT].type = WindowWidgetType::Empty;
|
||||
@@ -1960,7 +1962,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].text = STR_NUMERIC_DOWN;
|
||||
|
||||
ResizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, 138 }, { 85, kSpinnerHeight });
|
||||
auto spinnerStart = 124 + widgets[WIDX_TITLE].bottom;
|
||||
ResizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, spinnerStart }, { 85, kSpinnerHeight });
|
||||
|
||||
hold_down_widgets |= (1uLL << WIDX_SPEED_SETTING_SPINNER_UP) | (1uLL << WIDX_SPEED_SETTING_SPINNER_DOWN);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_SORT].left = width - 60;
|
||||
widgets[WIDX_SORT].right = width - 60 + 54;
|
||||
|
||||
ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, 46 }, { width - 216, kDropdownHeight });
|
||||
auto dropdownStart = widgets[WIDX_CURRENT_INFORMATION_TYPE].top;
|
||||
ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, dropdownStart }, { width - 216, kDropdownHeight });
|
||||
|
||||
// Refreshing the list can be a very intensive operation
|
||||
// owing to its use of ride_has_any_track_elements().
|
||||
|
||||
@@ -723,7 +723,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
int32_t y = kTabsStart;
|
||||
int32_t y = widgets[WIDX_TAB1].top;
|
||||
for (int32_t i = 0; i < kNumTabs; i++)
|
||||
{
|
||||
auto& widget = widgets[i + WIDX_TAB1];
|
||||
|
||||
@@ -782,13 +782,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
const auto lastTabWidget = &widgets[WIDX_SCENERY_TAB_1 + lastTabIndex];
|
||||
windowWidth = std::max<int32_t>(windowWidth, lastTabWidget->right + 3);
|
||||
|
||||
auto tabTop = widgets[WIDX_SCENERY_TITLE].bottom + 3;
|
||||
if (GetSceneryTabInfoForMisc() != nullptr)
|
||||
{
|
||||
auto miscTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 2];
|
||||
miscTabWidget->left = windowWidth - 2 * TabWidth - 6;
|
||||
miscTabWidget->right = windowWidth - TabWidth - 7;
|
||||
miscTabWidget->top = InitTabPosY;
|
||||
miscTabWidget->bottom = InitTabPosY + TabHeight;
|
||||
miscTabWidget->top = tabTop;
|
||||
miscTabWidget->bottom = tabTop + TabHeight;
|
||||
}
|
||||
|
||||
if (_tabEntries.back().IsAll())
|
||||
@@ -796,8 +797,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto allTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 1];
|
||||
allTabWidget->left = windowWidth - TabWidth - 6;
|
||||
allTabWidget->right = windowWidth - 7;
|
||||
allTabWidget->top = InitTabPosY;
|
||||
allTabWidget->bottom = InitTabPosY + TabHeight;
|
||||
allTabWidget->top = tabTop;
|
||||
allTabWidget->bottom = tabTop + TabHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
#define WWIDTH_MIN 500
|
||||
#define WHEIGHT_MIN 300
|
||||
#define WWIDTH_MAX 1200
|
||||
#define WHEIGHT_MAX 800
|
||||
#define ITEM_HEIGHT (3 + 9 + 3)
|
||||
static constexpr int32_t kWindowWidthMin = 500;
|
||||
static constexpr int32_t kWindowHeightMin = 288;
|
||||
static constexpr int32_t kWindowWidthMax = 1200;
|
||||
static constexpr int32_t kWindowHeightMax = 788;
|
||||
static constexpr int32_t kItemHeight = (3 + 9 + 3);
|
||||
|
||||
constexpr size_t MaxPlayerNameLength = 32;
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
page = 0;
|
||||
list_information_type = 0;
|
||||
|
||||
WindowSetResize(*this, WWIDTH_MIN, WHEIGHT_MIN, WWIDTH_MAX, WHEIGHT_MAX);
|
||||
WindowSetResize(*this, kWindowWidthMin, kWindowHeightMin, kWindowWidthMax, kWindowHeightMax);
|
||||
|
||||
no_list_items = static_cast<uint16_t>(_serverList.GetCount());
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnResize() override
|
||||
{
|
||||
WindowSetResize(*this, WWIDTH_MIN, WHEIGHT_MIN, WWIDTH_MAX, WHEIGHT_MAX);
|
||||
WindowSetResize(*this, kWindowWidthMin, kWindowHeightMin, kWindowWidthMax, kWindowHeightMax);
|
||||
}
|
||||
|
||||
void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override
|
||||
@@ -215,7 +215,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
return { 0, no_list_items * ITEM_HEIGHT };
|
||||
return { 0, no_list_items * kItemHeight };
|
||||
}
|
||||
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
@@ -248,7 +248,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto& listWidget = widgets[WIDX_LIST];
|
||||
|
||||
int32_t itemIndex = screenCoords.y / ITEM_HEIGHT;
|
||||
int32_t itemIndex = screenCoords.y / kItemHeight;
|
||||
bool showNetworkVersionTooltip = false;
|
||||
if (itemIndex < 0 || itemIndex >= no_list_items)
|
||||
{
|
||||
@@ -356,7 +356,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (highlighted)
|
||||
{
|
||||
GfxFilterRect(
|
||||
dpi, { 0, screenCoords.y, listWidgetWidth, screenCoords.y + ITEM_HEIGHT },
|
||||
dpi, { 0, screenCoords.y, listWidgetWidth, screenCoords.y + kItemHeight },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
_version = serverDetails.Version;
|
||||
}
|
||||
@@ -428,7 +428,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
screenCoords.x = right - numPlayersStringWidth;
|
||||
DrawText(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, { colours[1] }, players);
|
||||
|
||||
screenCoords.y += ITEM_HEIGHT;
|
||||
screenCoords.y += kItemHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return window;
|
||||
|
||||
window = windowMgr->Create<ServerListWindow>(
|
||||
WindowClass::ServerList, WWIDTH_MIN, WHEIGHT_MIN, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
WindowClass::ServerList, kWindowWidthMin, kWindowHeightMin, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -633,8 +633,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
if (viewport != nullptr)
|
||||
{
|
||||
int32_t newWidth = width - 30;
|
||||
int32_t newHeight = height - 62;
|
||||
auto widget = widgets[WIDX_VIEWPORT];
|
||||
auto newWidth = widget.width() - 1;
|
||||
auto newHeight = widget.height() - 1;
|
||||
viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
|
||||
|
||||
// Update the viewport size
|
||||
if (viewport->width != newWidth || viewport->height != newHeight)
|
||||
|
||||
@@ -300,7 +300,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(GetStaffWage(GetSelectedStaffType()));
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ width - 155, 32 }, STR_COST_PER_MONTH, ft);
|
||||
auto y = widgets[WIDX_STAFF_LIST_TITLE].bottom + 17;
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ width - 155, y }, STR_COST_PER_MONTH, ft);
|
||||
}
|
||||
|
||||
if (GetSelectedStaffType() != StaffType::Entertainer)
|
||||
|
||||
@@ -198,8 +198,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
DrawWidgets(dpi);
|
||||
|
||||
ScreenCoordsXY screenCoords;
|
||||
screenCoords.y = windowPos.y + 25;
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ WW / 2, widgets[WIDX_TITLE].bottom + 13 };
|
||||
|
||||
int32_t no_lines = 0;
|
||||
|
||||
@@ -207,14 +206,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(_description.c_str());
|
||||
DrawTextWrapped(
|
||||
dpi, { windowPos.x + WW / 2, screenCoords.y }, WW, STR_STRING, ft, { colours[1], TextAlignment::CENTRE });
|
||||
DrawTextWrapped(dpi, screenCoords, WW, STR_STRING, ft, { colours[1], TextAlignment::CENTRE });
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTextWrapped(
|
||||
dpi, { windowPos.x + WW / 2, screenCoords.y }, WW, _descriptionStringId, _descriptionArgs,
|
||||
{ colours[1], TextAlignment::CENTRE });
|
||||
dpi, screenCoords, WW, _descriptionStringId, _descriptionArgs, { colours[1], TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
screenCoords.y += 25;
|
||||
|
||||
@@ -58,6 +58,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<TitleExitWindow>(
|
||||
WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), 40, 64,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = windowMgr->Create<TitleLogoWindow>(
|
||||
WindowClass::TitleLogo, ScreenCoordsXY(0, 0), WW, WH, WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
WindowClass::TitleLogo, ScreenCoordsXY(0, 0), WW, WH, WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -290,6 +290,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<TitleMenuWindow>(
|
||||
WindowClass::TitleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), 0, windowHeight,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
@@ -59,7 +59,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
window = windowMgr->Create<TitleOptionsWindow>(
|
||||
WindowClass::TitleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), 80, 15,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
|
||||
return window;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
window = windowMgr->Create<TitleVersionWindow>(
|
||||
WindowClass::TitleVersion, ScreenCoordsXY(kTextOffset, ContextGetHeight() - 30), WW, WH,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->Create(
|
||||
std::move(tooltipWindow), WindowClass::Tooltip, windowPos, width, height, WF_TRANSPARENT | WF_STICK_TO_FRONT);
|
||||
std::move(tooltipWindow), WindowClass::Tooltip, windowPos, width, height,
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_NO_TITLE_BAR);
|
||||
}
|
||||
|
||||
void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
|
||||
|
||||
@@ -1015,7 +1015,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<TopToolbar>(
|
||||
WindowClass::TopToolbar, ScreenCoordsXY(0, 0), ContextGetWidth(), kTopToolbarHeight + 1,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR);
|
||||
|
||||
window->SetWidgets(_topToolbarWidgets);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace OpenRCT2
|
||||
}
|
||||
};
|
||||
|
||||
constexpr uint8_t kCloseButtonWidth = 10;
|
||||
constexpr uint8_t kCloseButtonSize = 10;
|
||||
|
||||
constexpr int32_t kScrollableRowHeight = 12;
|
||||
constexpr uint8_t kListRowHeight = 12;
|
||||
|
||||
@@ -96,6 +96,8 @@ namespace OpenRCT2
|
||||
// Create only flags
|
||||
WF_AUTO_POSITION = (1 << 16),
|
||||
WF_CENTRE_SCREEN = (1 << 17),
|
||||
|
||||
WF_NO_TITLE_BAR = (1 << 18),
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -119,6 +119,11 @@ namespace OpenRCT2
|
||||
|
||||
WindowBase& operator=(const WindowBase&) = delete;
|
||||
|
||||
constexpr bool canBeResized() const
|
||||
{
|
||||
return (flags & WF_RESIZABLE) && (min_width != max_width || min_height != max_height);
|
||||
}
|
||||
|
||||
// Events
|
||||
virtual void OnOpen()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user