forked from rosebudai/OpenRCT2-Web
Adjust more hardcoded top positions
This commit is contained in:
1 parent
d9ba40b266
commit
47795f398c
11 files changed
+39
-42
No files matched your search
@@ -613,7 +613,10 @@ static StringId window_cheats_page_titles[] = {
|
||||
{
|
||||
colour.setFlag(ColourFlag::inset, true);
|
||||
}
|
||||
DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ _xLcol, 93 }, STR_BOTTOM_TOOLBAR_CASH, ft, { colour });
|
||||
|
||||
auto& widget = widgets[WIDX_MONEY_SPINNER];
|
||||
DrawTextBasic(
|
||||
dpi, windowPos + ScreenCoordsXY{ _xLcol, widget.top + 2 }, STR_BOTTOM_TOOLBAR_CASH, ft, { colour });
|
||||
}
|
||||
else if (page == WINDOW_CHEATS_PAGE_DATE)
|
||||
{
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto screenCoords = ScreenCoordsXY{ 0, kTableCellHeight + 2 };
|
||||
|
||||
Widget self = widgets[WIDX_SUMMARY_SCROLL];
|
||||
auto& self = widgets[WIDX_SUMMARY_SCROLL];
|
||||
int32_t row_width = std::max<uint16_t>(scrolls[0].contentWidth, self.width());
|
||||
|
||||
// Expenditure / Income row labels
|
||||
@@ -678,7 +678,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
// Count number of active campaigns
|
||||
int32_t numActiveCampaigns = static_cast<int32_t>(getGameState().marketingCampaigns.size());
|
||||
int32_t y = std::max(1, numActiveCampaigns) * kListRowHeight + 92;
|
||||
int32_t y = widgets[WIDX_TAB_1].top + std::max(1, numActiveCampaigns) * kListRowHeight + 75;
|
||||
|
||||
// Update group box positions
|
||||
widgets[WIDX_ACTIVE_CAMPAIGNS_GROUP].bottom = y - 22;
|
||||
|
||||
@@ -438,22 +438,21 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnResizeCommon()
|
||||
{
|
||||
// Get page specific min and max size
|
||||
int32_t minWidth = _guestWindowPageSizes[page][0].width;
|
||||
int32_t minHeight = _guestWindowPageSizes[page][0].height;
|
||||
int32_t maxWidth = _guestWindowPageSizes[page][1].width;
|
||||
int32_t maxHeight = _guestWindowPageSizes[page][1].height;
|
||||
auto minSize = _guestWindowPageSizes[page][0];
|
||||
auto maxSize = _guestWindowPageSizes[page][1];
|
||||
|
||||
// Ensure min size is large enough for all tabs to fit
|
||||
for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++)
|
||||
{
|
||||
if (!WidgetIsDisabled(*this, i))
|
||||
{
|
||||
minWidth = std::max(minWidth, widgets[i].right + 3);
|
||||
minSize.width = std::max(minSize.width, widgets[i].right + 3);
|
||||
}
|
||||
}
|
||||
maxWidth = std::max(minWidth, maxWidth);
|
||||
maxSize.width = std::max(minSize.width, maxSize.width);
|
||||
|
||||
WindowSetResize(*this, { minWidth, minHeight }, { maxWidth, maxHeight });
|
||||
WindowSetResize(*this, minSize, maxSize);
|
||||
ResizeFrameWithPage();
|
||||
}
|
||||
|
||||
void OnPrepareDrawCommon()
|
||||
@@ -468,8 +467,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
|
||||
ResizeFrameWithPage();
|
||||
|
||||
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
static constexpr ScreenCoordsXY kInGameSize = { 94, 94 };
|
||||
static constexpr ScreenCoordsXY kEditorSize = { 280, 104 };
|
||||
static constexpr ScreenSize kInGameSize = { 94, 94 };
|
||||
static constexpr ScreenSize kEditorSize = { 280, 104 };
|
||||
|
||||
static constexpr StringId WINDOW_TITLE = STR_LAND_RIGHTS;
|
||||
static constexpr int32_t WW = kInGameSize.x;
|
||||
static constexpr int32_t WH = kInGameSize.y;
|
||||
static constexpr int32_t WW = kInGameSize.width;
|
||||
static constexpr int32_t WH = kInGameSize.height;
|
||||
|
||||
enum WindowLandRightsWidgetIdx
|
||||
{
|
||||
@@ -348,7 +348,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX].type = WindowWidgetType::Checkbox;
|
||||
}
|
||||
|
||||
ScreenCoordsXY GetModeDimensions() const
|
||||
ScreenSize GetModeDimensions() const
|
||||
{
|
||||
if (IsOwnershipMode())
|
||||
return kEditorSize;
|
||||
@@ -361,7 +361,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
SetWidgetPressed(WIDX_PREVIEW, true);
|
||||
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
|
||||
|
||||
if (width != GetModeDimensions().x)
|
||||
if (width != GetModeDimensions().width)
|
||||
OnResize();
|
||||
|
||||
if (IsOwnershipMode())
|
||||
@@ -381,8 +381,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
Invalidate();
|
||||
|
||||
auto dimensions = GetModeDimensions();
|
||||
width = dimensions.x;
|
||||
height = dimensions.y;
|
||||
WindowSetResize(*this, dimensions, dimensions);
|
||||
|
||||
if (windowPos.x + width > ContextGetWidth())
|
||||
windowPos.x = ContextGetWidth() - width;
|
||||
|
||||
@@ -112,19 +112,18 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
#pragma region Widgets
|
||||
|
||||
static constexpr int32_t WW = 300;
|
||||
static constexpr int32_t WH = 220;
|
||||
|
||||
#define SHARED_WIDGETS(PAGE_TITLE) \
|
||||
WINDOW_SHIM(PAGE_TITLE, WW, WH), /* WIDX_BACKGROUND, WIDX_TITLE, WIDX_CLOSE */ \
|
||||
MakeWidget({ 0, 43 }, { WW, 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 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 Widget BaseWidgets[] = {
|
||||
SHARED_WIDGETS(STR_MAPGEN_CAPTION_GENERATOR),
|
||||
MakeSpinnerWidgets ({165, 52}, { 50, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_COMMA16 ), // NB: 3 widgets
|
||||
@@ -156,7 +155,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr Widget WaterWidgets[] = {
|
||||
SHARED_WIDGETS(STR_MAPGEN_CAPTION_WATER),
|
||||
MakeSpinnerWidgets({179, 52}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeWidget ({ 10, 70}, {195, 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[] = {
|
||||
@@ -1534,7 +1533,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* MapgenOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<MapGenWindow>(WindowClass::Mapgen, WW, WH, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
return windowMgr->FocusOrCreate<MapGenWindow>(
|
||||
WindowClass::Mapgen, kWindowSize.width, kWindowSize.height, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
static void HeightmapLoadsaveCallback(ModalResult result, const utf8* path)
|
||||
|
||||
@@ -678,7 +678,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
DrawPixelInfo clippedDPI;
|
||||
if (ClipDrawPixelInfo(clippedDPI, dpi, windowPos, width, height))
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ 3, 50 };
|
||||
auto screenCoords = ScreenCoordsXY{ 3, widgets[WIDX_CONTENT_PANEL].top + 7 };
|
||||
int32_t newWidth = width - 6;
|
||||
|
||||
const auto& name = NetworkGetServerName();
|
||||
|
||||
@@ -440,7 +440,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
// Draw ping
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 90, 24 };
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ 90, widgets[WIDX_TAB_1].midY() };
|
||||
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(STR_PING);
|
||||
|
||||
@@ -122,8 +122,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnOpen() override
|
||||
{
|
||||
SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT);
|
||||
width = WW_DEVELOPMENT;
|
||||
height = WH_DEVELOPMENT;
|
||||
ResearchUpdateUncompletedTypes();
|
||||
}
|
||||
|
||||
@@ -309,7 +307,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowBase* ResearchOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<ResearchWindow>(WindowClass::Research, WW_FUNDING, WH_FUNDING, WF_10);
|
||||
auto* window = windowMgr->FocusOrCreate<ResearchWindow>(WindowClass::Research, WW_DEVELOPMENT, WH_DEVELOPMENT, WF_10);
|
||||
window->SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT);
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -4935,7 +4935,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + 103 }, 97, STR_STATION_STYLE, {});
|
||||
auto labelPos = windowPos + ScreenCoordsXY{ 3, widgets[WIDX_ENTRANCE_STYLE].top };
|
||||
DrawTextEllipsised(dpi, labelPos, 97, STR_STATION_STYLE, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
DrawWidgets(dpi);
|
||||
|
||||
ScreenCoordsXY stringCoords(windowPos.x + 125, windowPos.y + 30);
|
||||
ScreenCoordsXY stringCoords(windowPos.x + 125, windowPos.y + widgets[WIDX_TITLE].bottom + 16);
|
||||
|
||||
auto ft = Formatter();
|
||||
if (_shortcutCustomName.empty())
|
||||
|
||||
@@ -187,8 +187,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
|
||||
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_ZOOM_IN].left = width - 27;
|
||||
widgets[WIDX_ZOOM_IN].right = width - 2;
|
||||
@@ -213,6 +211,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
if (viewport != nullptr)
|
||||
{
|
||||
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
|
||||
viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 };
|
||||
viewport->width = widgets[WIDX_VIEWPORT].width() - 1;
|
||||
viewport->height = widgets[WIDX_VIEWPORT].height() - 1;
|
||||
|
||||
Reference in new issue
Block a user