Ui::Point (#1088)
* Introduce Ui::Point and Ui::Point32 * Remove xy32 replace with Point / Point32 * Remove empty file * Fix compiler error * Rename UiSize to Size
This commit is contained in:
parent
b427523621
commit
f5494630c6
|
@ -558,9 +558,9 @@ namespace OpenLoco::Gfx
|
|||
}
|
||||
|
||||
// 0x00451189
|
||||
static Gfx::point_t loopNewline(Context* context, Gfx::point_t origin, uint8_t* str)
|
||||
static Ui::Point loopNewline(Context* context, Ui::Point origin, uint8_t* str)
|
||||
{
|
||||
Gfx::point_t pos = origin;
|
||||
Ui::Point pos = origin;
|
||||
while (true)
|
||||
{
|
||||
// When offscreen in y dimension don't draw text
|
||||
|
@ -791,10 +791,10 @@ namespace OpenLoco::Gfx
|
|||
* @param context @<edi>
|
||||
* @param text @<esi>
|
||||
*/
|
||||
Gfx::point_t drawString(Context& context, const int16_t x, const int16_t y, uint8_t colour, void* str)
|
||||
Ui::Point drawString(Context& context, int16_t x, int16_t y, uint8_t colour, void* str)
|
||||
{
|
||||
// 0x00E04348, 0x00E0434A
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
if (colour == FormatFlags::fe)
|
||||
{
|
||||
|
@ -949,7 +949,7 @@ namespace OpenLoco::Gfx
|
|||
*/
|
||||
void drawString_494B3F(
|
||||
Context& context,
|
||||
point_t* origin,
|
||||
Point* origin,
|
||||
uint8_t colour,
|
||||
string_id stringId,
|
||||
const void* args)
|
||||
|
@ -1136,7 +1136,7 @@ namespace OpenLoco::Gfx
|
|||
*/
|
||||
uint16_t drawStringCentredWrapped(
|
||||
Context& context,
|
||||
point_t& origin,
|
||||
Point& origin,
|
||||
uint16_t width,
|
||||
uint8_t colour,
|
||||
string_id stringId,
|
||||
|
@ -1424,7 +1424,7 @@ namespace OpenLoco::Gfx
|
|||
return *dst != nullptr;
|
||||
}
|
||||
|
||||
bool clipContext(Gfx::Context** dst, Gfx::Context* src, point_t pos, Gfx::ui_size_t size)
|
||||
bool clipContext(Gfx::Context** dst, Gfx::Context* src, Point pos, Ui::Size size)
|
||||
{
|
||||
return clipContext(dst, src, pos.x, pos.y, size.width, size.height);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../OpenLoco.h"
|
||||
#include "../Types.hpp"
|
||||
#include "../Ui/Rect.h"
|
||||
#include "Types.h"
|
||||
#include "../Ui/Types.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace OpenLoco
|
||||
|
@ -137,7 +137,7 @@ namespace OpenLoco::Gfx
|
|||
uint16_t getStringWidth(const char* buffer);
|
||||
uint16_t getMaxStringWidth(const char* buffer);
|
||||
|
||||
Gfx::point_t drawString(Context& context, int16_t x, int16_t y, uint8_t colour, void* str);
|
||||
Ui::Point drawString(Context& context, int16_t x, int16_t y, uint8_t colour, void* str);
|
||||
|
||||
int16_t drawString_495224(
|
||||
Context& context,
|
||||
|
@ -156,7 +156,7 @@ namespace OpenLoco::Gfx
|
|||
const void* args = nullptr);
|
||||
void drawString_494B3F(
|
||||
Context& context,
|
||||
point_t* origin,
|
||||
Ui::Point* origin,
|
||||
uint8_t colour,
|
||||
string_id stringId,
|
||||
const void* args = nullptr);
|
||||
|
@ -206,7 +206,7 @@ namespace OpenLoco::Gfx
|
|||
const void* args = nullptr);
|
||||
uint16_t drawStringCentredWrapped(
|
||||
Context& context,
|
||||
point_t& origin,
|
||||
Ui::Point& origin,
|
||||
uint16_t width,
|
||||
uint8_t colour,
|
||||
string_id stringId,
|
||||
|
@ -244,6 +244,6 @@ namespace OpenLoco::Gfx
|
|||
void redrawScreenRect(int16_t left, int16_t top, int16_t right, int16_t bottom);
|
||||
|
||||
bool clipContext(Gfx::Context** dst, Gfx::Context* src, int16_t x, int16_t y, int16_t width, int16_t height);
|
||||
bool clipContext(Gfx::Context** dst, Gfx::Context* src, Gfx::point_t pos, Gfx::ui_size_t size);
|
||||
bool clipContext(Gfx::Context** dst, Gfx::Context* src, Ui::Point pos, Ui::Size size);
|
||||
G1Element* getG1Element(uint32_t id);
|
||||
}
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace OpenLoco::Gfx
|
||||
{
|
||||
struct point_t
|
||||
{
|
||||
int16_t x = 0;
|
||||
int16_t y = 0;
|
||||
|
||||
constexpr point_t(){};
|
||||
|
||||
constexpr point_t(int16_t x, int16_t y)
|
||||
: x(x)
|
||||
, y(y)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const point_t& rhs)
|
||||
{
|
||||
return x == rhs.x && y == rhs.y;
|
||||
}
|
||||
|
||||
bool operator==(const int16_t rhs)
|
||||
{
|
||||
return x == rhs && y == rhs;
|
||||
}
|
||||
|
||||
point_t& operator+=(const point_t& rhs)
|
||||
{
|
||||
x += rhs.x;
|
||||
y += rhs.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
point_t& operator-=(const point_t& rhs)
|
||||
{
|
||||
x -= rhs.x;
|
||||
y -= rhs.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend point_t operator+(point_t lhs, const point_t& rhs)
|
||||
{
|
||||
lhs += rhs;
|
||||
return lhs;
|
||||
}
|
||||
|
||||
friend point_t operator-(point_t lhs, const point_t& rhs)
|
||||
{
|
||||
lhs -= rhs;
|
||||
return lhs;
|
||||
}
|
||||
};
|
||||
|
||||
struct ui_size_t
|
||||
{
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
|
||||
constexpr ui_size_t(uint16_t width, uint16_t height)
|
||||
: width(width)
|
||||
, height(height)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
|
@ -14,8 +14,7 @@ namespace OpenLoco::Input
|
|||
{
|
||||
loco_global<uint32_t, 0x00523368> _flags;
|
||||
static loco_global<State, 0x0052336D> _state;
|
||||
static int32_t _cursor_drag_start_x;
|
||||
static int32_t _cursor_drag_start_y;
|
||||
static Ui::Point32 _cursor_drag_start;
|
||||
loco_global<uint32_t, 0x00525374> _cursor_drag_state;
|
||||
|
||||
void init()
|
||||
|
@ -61,8 +60,7 @@ namespace OpenLoco::Input
|
|||
{
|
||||
_cursor_drag_state = 1;
|
||||
auto cursor = Ui::getCursorPos();
|
||||
_cursor_drag_start_x = cursor.x;
|
||||
_cursor_drag_start_y = cursor.y;
|
||||
_cursor_drag_start = cursor;
|
||||
Ui::hideCursor();
|
||||
}
|
||||
}
|
||||
|
@ -72,20 +70,19 @@ namespace OpenLoco::Input
|
|||
if (_cursor_drag_state != 0)
|
||||
{
|
||||
_cursor_drag_state = 0;
|
||||
Ui::setCursorPos(_cursor_drag_start_x, _cursor_drag_start_y);
|
||||
Ui::setCursorPos(_cursor_drag_start.x, _cursor_drag_start.y);
|
||||
Ui::showCursor();
|
||||
}
|
||||
}
|
||||
|
||||
Gfx::point_t getNextDragOffset()
|
||||
Ui::Point getNextDragOffset()
|
||||
{
|
||||
auto current = Ui::getCursorPos();
|
||||
|
||||
auto deltaX = current.x - _cursor_drag_start_x;
|
||||
auto deltaY = current.y - _cursor_drag_start_y;
|
||||
auto delta = current - _cursor_drag_start;
|
||||
|
||||
Ui::setCursorPos(_cursor_drag_start_x, _cursor_drag_start_y);
|
||||
Ui::setCursorPos(_cursor_drag_start.x, _cursor_drag_start.y);
|
||||
|
||||
return { static_cast<int16_t>(deltaX), static_cast<int16_t>(deltaY) };
|
||||
return { static_cast<int16_t>(delta.x), static_cast<int16_t>(delta.y) };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ namespace OpenLoco::Input
|
|||
State state();
|
||||
void state(State);
|
||||
|
||||
Gfx::point_t getMouseLocation();
|
||||
Gfx::point_t getMouseLocation2();
|
||||
Ui::Point getMouseLocation();
|
||||
Ui::Point getMouseLocation2();
|
||||
bool isHovering(Ui::WindowType);
|
||||
bool isHovering(Ui::WindowType, Ui::WindowNumber_t);
|
||||
bool isHovering(Ui::WindowType type, Ui::WindowNumber_t number, Ui::WidgetIndex_t widgetIndex);
|
||||
|
@ -108,16 +108,16 @@ namespace OpenLoco::Input
|
|||
void moveMouse(int32_t x, int32_t y, int32_t relX, int32_t relY);
|
||||
void sub_407218();
|
||||
void sub_407231();
|
||||
Gfx::point_t getNextDragOffset();
|
||||
Ui::Point getNextDragOffset();
|
||||
void processMouseOver(int16_t x, int16_t y);
|
||||
void processKeyboardInput();
|
||||
|
||||
void windowPositionBegin(int16_t x, int16_t y, Ui::Window* window, Ui::WidgetIndex_t widget_index);
|
||||
|
||||
Gfx::point_t getScrollLastLocation();
|
||||
Gfx::point_t getDragLastLocation();
|
||||
Gfx::point_t getTooltipMouseLocation();
|
||||
void setTooltipMouseLocation(const Gfx::point_t& loc);
|
||||
Ui::Point getScrollLastLocation();
|
||||
Ui::Point getDragLastLocation();
|
||||
Ui::Point getTooltipMouseLocation();
|
||||
void setTooltipMouseLocation(const Ui::Point& loc);
|
||||
uint16_t getTooltipTimeout();
|
||||
void setTooltipTimeout(uint16_t tooltipTimeout);
|
||||
|
||||
|
|
|
@ -401,7 +401,7 @@ namespace OpenLoco::Input
|
|||
if (hasKeyModifier(KeyModifier::shift) || hasKeyModifier(KeyModifier::control))
|
||||
return;
|
||||
|
||||
Gfx::point_t delta = { 0, 0 };
|
||||
Ui::Point delta = { 0, 0 };
|
||||
auto cursor = getMouseLocation();
|
||||
|
||||
if (cursor.x == 0)
|
||||
|
@ -448,7 +448,7 @@ namespace OpenLoco::Input
|
|||
if (WindowManager::find(WindowType::textInput) != nullptr)
|
||||
return;
|
||||
|
||||
Gfx::point_t delta = { 0, 0 };
|
||||
Ui::Point delta = { 0, 0 };
|
||||
|
||||
if (_keyboardState[DIK_LEFT] & 0x80)
|
||||
delta.x -= 8;
|
||||
|
|
|
@ -784,7 +784,7 @@ namespace OpenLoco::Input
|
|||
return;
|
||||
}
|
||||
|
||||
Gfx::point_t dragOffset = { x, y };
|
||||
Ui::Point dragOffset = { x, y };
|
||||
if (Tutorial::state() != Tutorial::State::playing)
|
||||
{
|
||||
// Fix #151: use relative drag from one frame to the next rather than
|
||||
|
@ -2054,32 +2054,32 @@ namespace OpenLoco::Input
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::point_t getMouseLocation()
|
||||
Ui::Point getMouseLocation()
|
||||
{
|
||||
return Gfx::point_t(_cursorX, _cursorY);
|
||||
return Ui::Point(_cursorX, _cursorY);
|
||||
}
|
||||
|
||||
Gfx::point_t getMouseLocation2()
|
||||
Ui::Point getMouseLocation2()
|
||||
{
|
||||
return Gfx::point_t(_cursorX2, _cursorY2);
|
||||
return Ui::Point(_cursorX2, _cursorY2);
|
||||
}
|
||||
|
||||
Gfx::point_t getTooltipMouseLocation()
|
||||
Ui::Point getTooltipMouseLocation()
|
||||
{
|
||||
return Gfx::point_t(_tooltipCursorX, _tooltipCursorY);
|
||||
return Ui::Point(_tooltipCursorX, _tooltipCursorY);
|
||||
}
|
||||
|
||||
Gfx::point_t getDragLastLocation()
|
||||
Ui::Point getDragLastLocation()
|
||||
{
|
||||
return Gfx::point_t(_dragLastX, _dragLastY);
|
||||
return Ui::Point(_dragLastX, _dragLastY);
|
||||
}
|
||||
|
||||
Gfx::point_t getScrollLastLocation()
|
||||
Ui::Point getScrollLastLocation()
|
||||
{
|
||||
return Gfx::point_t(_5233A4, _5233A6);
|
||||
return Ui::Point(_5233A4, _5233A6);
|
||||
}
|
||||
|
||||
void setTooltipMouseLocation(const Gfx::point_t& loc)
|
||||
void setTooltipMouseLocation(const Ui::Point& loc)
|
||||
{
|
||||
_tooltipCursorX = loc.x;
|
||||
_tooltipCursorY = loc.y;
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
namespace OpenLoco
|
||||
{
|
||||
using xy32 = Math::Vector::TVector2<int32_t, 1, false>;
|
||||
|
||||
namespace Location
|
||||
{
|
||||
constexpr int16_t null = (int16_t)0x8000u;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace OpenLoco
|
|||
// 0x00490DE7
|
||||
void AirportObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, [[maybe_unused]] const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
ObjectManager::drawGenericDescription(context, rowPosition, designed_year, obsolete_year);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace OpenLoco
|
|||
// 0x0042DE82
|
||||
void BuildingObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, [[maybe_unused]] const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
ObjectManager::drawGenericDescription(context, rowPosition, designedYear, obsoleteYear);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace OpenLoco
|
|||
{
|
||||
// TODO: Should only be defined in ObjectSelectionWindow
|
||||
static const uint8_t descriptionRowHeight = 10;
|
||||
static const Gfx::ui_size_t objectPreviewSize = { 112, 112 };
|
||||
static const Ui::Size objectPreviewSize = { 112, 112 };
|
||||
|
||||
// 0x00434D5B
|
||||
void CompetitorObject::drawPreviewImage(Gfx::Context& context, const int16_t x, const int16_t y) const
|
||||
|
@ -22,7 +22,7 @@ namespace OpenLoco
|
|||
// 0x00434DA7
|
||||
void CompetitorObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, [[maybe_unused]] const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
{
|
||||
auto args = FormatArguments();
|
||||
args.push<uint16_t>(intelligence);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace OpenLoco
|
|||
// 0x00490F2C
|
||||
void DockObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, [[maybe_unused]] const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
ObjectManager::drawGenericDescription(context, rowPosition, designed_year, obsolete_year);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace OpenLoco
|
|||
// 0x004781A4
|
||||
void LevelCrossingObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, [[maybe_unused]] const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
ObjectManager::drawGenericDescription(context, rowPosition, designedYear, 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -867,7 +867,7 @@ namespace OpenLoco::ObjectManager
|
|||
// TODO: Should only be defined in ObjectSelectionWindow
|
||||
static const uint8_t descriptionRowHeight = 10;
|
||||
|
||||
void drawGenericDescription(Gfx::Context& context, Gfx::point_t& rowPosition, const uint16_t designed, const uint16_t obsolete)
|
||||
void drawGenericDescription(Gfx::Context& context, Ui::Point& rowPosition, const uint16_t designed, const uint16_t obsolete)
|
||||
{
|
||||
if (designed != 0)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "../Core/Optional.hpp"
|
||||
#include "../Core/Span.hpp"
|
||||
#include "../Ui/Types.hpp"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
@ -16,7 +17,6 @@ namespace OpenLoco
|
|||
namespace Gfx
|
||||
{
|
||||
struct Context;
|
||||
struct point_t;
|
||||
}
|
||||
|
||||
enum class ObjectType
|
||||
|
@ -309,5 +309,5 @@ namespace OpenLoco::ObjectManager
|
|||
|
||||
size_t getByteLength(LoadedObjectIndex id);
|
||||
|
||||
void drawGenericDescription(Gfx::Context& context, Gfx::point_t& rowPosition, const uint16_t designed, const uint16_t obsolete);
|
||||
void drawGenericDescription(Gfx::Context& context, Ui::Point& rowPosition, const uint16_t designed, const uint16_t obsolete);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace OpenLoco
|
|||
// 0x00490C59
|
||||
void RoadStationObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, [[maybe_unused]] const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
ObjectManager::drawGenericDescription(context, rowPosition, designed_year, obsolete_year);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "StreetLightObject.h"
|
||||
#include "../Graphics/Gfx.h"
|
||||
#include "../Graphics/Types.h"
|
||||
|
||||
namespace OpenLoco
|
||||
{
|
||||
|
@ -10,7 +9,7 @@ namespace OpenLoco
|
|||
// 0x00477F69
|
||||
void StreetLightObject::drawPreviewImage(Gfx::Context& context, const int16_t x, const int16_t y) const
|
||||
{
|
||||
Gfx::point_t imgPosition = Gfx::point_t{ x, y } - Gfx::point_t{ 20, 1 };
|
||||
Ui::Point imgPosition = Ui::Point{ x, y } - Ui::Point{ 20, 1 };
|
||||
for (auto i = 0; i < 3; i++)
|
||||
{
|
||||
auto imageId = (i * 4) + image;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace OpenLoco
|
|||
// 0x00490A68
|
||||
void TrainStationObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, [[maybe_unused]] const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
ObjectManager::drawGenericDescription(context, rowPosition, designed_year, obsolete_year);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace OpenLoco
|
|||
image = Gfx::recolour(image, colour);
|
||||
}
|
||||
|
||||
Gfx::point_t treePos = Gfx::point_t{ x, y } + Gfx::point_t{ 0, 48 };
|
||||
Ui::Point treePos = Ui::Point{ x, y } + Ui::Point{ 0, 48 };
|
||||
|
||||
if (flags & TreeObjectFlags::hasSnowVariation)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace OpenLoco
|
|||
static loco_global<uint16_t, 0x0052622E> _52622E; // Tick related
|
||||
|
||||
// 0x004B7733
|
||||
static void drawVehicle(Gfx::Context* context, const VehicleObject* vehicleObject, uint8_t eax, uint8_t esi, Gfx::point_t offset)
|
||||
static void drawVehicle(Gfx::Context* context, const VehicleObject* vehicleObject, uint8_t eax, uint8_t esi, Ui::Point offset)
|
||||
{
|
||||
// Eventually calls 0x4B777B part of 0x4B7741
|
||||
registers regs;
|
||||
|
@ -36,7 +36,7 @@ namespace OpenLoco
|
|||
uint8_t unk1 = _52622E & 0x3F;
|
||||
uint8_t unk2 = ((_52622E + 2) / 4) & 0x3F;
|
||||
|
||||
drawVehicle(&context, this, unk1, unk2, Gfx::point_t{ x, y } + Gfx::point_t{ 0, 19 });
|
||||
drawVehicle(&context, this, unk1, unk2, Ui::Point{ x, y } + Ui::Point{ 0, 19 });
|
||||
}
|
||||
|
||||
// TODO: Should only be defined in ObjectSelectionWindow
|
||||
|
@ -45,7 +45,7 @@ namespace OpenLoco
|
|||
// 0x004B8C9D
|
||||
void VehicleObject::drawDescription(Gfx::Context& context, const int16_t x, const int16_t y, const int16_t width) const
|
||||
{
|
||||
Gfx::point_t rowPosition = { x, y };
|
||||
Ui::Point rowPosition = { x, y };
|
||||
ObjectManager::drawGenericDescription(context, rowPosition, designed, obsolete);
|
||||
if (power != 0 && (mode == TransportMode::road || mode == TransportMode::rail))
|
||||
{
|
||||
|
|
|
@ -639,8 +639,7 @@ namespace OpenLoco
|
|||
{
|
||||
Config::get().var_72 = 16;
|
||||
const auto cursor = Ui::getCursorPos();
|
||||
addr<0x00F2538C, int32_t>() = cursor.x;
|
||||
addr<0x00F25390, int32_t>() = cursor.y;
|
||||
addr<0x00F2538C, Ui::Point32>() = cursor;
|
||||
Gfx::clear(Gfx::screenContext(), 0);
|
||||
addr<0x00F2539C, int32_t>() = 0;
|
||||
}
|
||||
|
@ -789,8 +788,7 @@ namespace OpenLoco
|
|||
{
|
||||
addr<0x005252DC, int32_t>() = 1;
|
||||
const auto cursor = Ui::getCursorPos();
|
||||
addr<0x00F2538C, int32_t>() = cursor.x;
|
||||
addr<0x00F25390, int32_t>() = cursor.y;
|
||||
addr<0x00F2538C, Ui::Point32>() = cursor;
|
||||
Ui::setCursorPos(addr<0x00F2538C, int32_t>(), addr<0x00F25390, int32_t>());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ namespace OpenLoco::Paint
|
|||
}
|
||||
}
|
||||
|
||||
static bool isSpriteInteractedWithPaletteSet(Gfx::Context* context, uint32_t imageId, const Gfx::point_t& coords, const Gfx::PaletteMap& paletteMap)
|
||||
static bool isSpriteInteractedWithPaletteSet(Gfx::Context* context, uint32_t imageId, const Ui::Point& coords, const Gfx::PaletteMap& paletteMap)
|
||||
{
|
||||
static loco_global<const uint8_t*, 0x0050B860> _paletteMap;
|
||||
static loco_global<bool, 0x00E40114> _interactionResult;
|
||||
|
@ -469,7 +469,7 @@ namespace OpenLoco::Paint
|
|||
}
|
||||
|
||||
// 0x00447A0E
|
||||
static bool isSpriteInteractedWith(Gfx::Context* context, uint32_t imageId, const Gfx::point_t& coords)
|
||||
static bool isSpriteInteractedWith(Gfx::Context* context, uint32_t imageId, const Ui::Point& coords)
|
||||
{
|
||||
static loco_global<bool, 0x00E40114> _interactionResult;
|
||||
static loco_global<uint32_t, 0x00E04324> _interactionFlags;
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace OpenLoco::S5
|
|||
}
|
||||
}
|
||||
|
||||
static void drawPreviewImage(void* pixels, Gfx::ui_size_t size)
|
||||
static void drawPreviewImage(void* pixels, Ui::Size size)
|
||||
{
|
||||
auto mainViewport = WindowManager::getMainViewport();
|
||||
if (mainViewport != nullptr)
|
||||
|
|
|
@ -319,7 +319,7 @@ namespace OpenLoco::Ui
|
|||
}
|
||||
|
||||
// 0x00407FCD
|
||||
xy32 getCursorPos()
|
||||
Point32 getCursorPos()
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace OpenLoco::Ui
|
|||
void disposeInput();
|
||||
void disposeCursors();
|
||||
void setCursor(CursorId id);
|
||||
xy32 getCursorPos();
|
||||
Point32 getCursorPos();
|
||||
void setCursorPos(int32_t x, int32_t y);
|
||||
void hideCursor();
|
||||
void showCursor();
|
||||
|
@ -215,10 +215,10 @@ namespace OpenLoco::Ui
|
|||
InteractionArg rightOver(int16_t x, int16_t y);
|
||||
|
||||
std::pair<ViewportInteraction::InteractionArg, Ui::Viewport*> getMapCoordinatesFromPos(int32_t screenX, int32_t screenY, int32_t flags);
|
||||
std::optional<Map::Pos2> getSurfaceOrWaterLocFromUi(const xy32& screenCoords);
|
||||
std::optional<Map::Pos2> getSurfaceOrWaterLocFromUi(const Point& screenCoords);
|
||||
uint8_t getQuadrantOrCentreFromPos(const Map::Pos2& loc);
|
||||
uint8_t getQuadrantFromPos(const Map::Pos2& loc);
|
||||
uint8_t getSideFromPos(const Map::Pos2& loc);
|
||||
std::optional<std::pair<Map::Pos2, Ui::Viewport*>> getSurfaceLocFromUi(const xy32& screenCoords);
|
||||
std::optional<std::pair<Map::Pos2, Ui::Viewport*>> getSurfaceLocFromUi(const Point& screenCoords);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ namespace OpenLoco::Ui::Dropdown
|
|||
}
|
||||
|
||||
// 0x004CCF1E
|
||||
static void open(Gfx::point_t origin, Gfx::ui_size_t size, Colour_t colour)
|
||||
static void open(Ui::Point origin, Ui::Size size, Colour_t colour)
|
||||
{
|
||||
auto window = WindowManager::createWindow(WindowType::dropdown, origin, size, WindowFlags::stick_to_front, &common::events);
|
||||
|
||||
|
@ -374,8 +374,8 @@ namespace OpenLoco::Ui::Dropdown
|
|||
widgets[0].bottom = dropdownHeight;
|
||||
dropdownHeight++;
|
||||
|
||||
Gfx::ui_size_t size = { static_cast<uint16_t>(_dropdownItemWidth), dropdownHeight };
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Size size = { static_cast<uint16_t>(_dropdownItemWidth), dropdownHeight };
|
||||
Ui::Point origin = { x, y };
|
||||
origin.y += height;
|
||||
|
||||
if ((size.height + origin.y) > Ui::height() || origin.y < 0)
|
||||
|
@ -466,8 +466,8 @@ namespace OpenLoco::Ui::Dropdown
|
|||
int16_t dropdownHeight = (static_cast<int16_t>(count) * _dropdownItemHeight) + 3;
|
||||
common::widgets[0].bottom = dropdownHeight;
|
||||
dropdownHeight++;
|
||||
Gfx::ui_size_t size = { static_cast<uint16_t>(width), static_cast<uint16_t>(height) };
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Size size = { static_cast<uint16_t>(width), static_cast<uint16_t>(height) };
|
||||
Ui::Point origin = { x, y };
|
||||
origin.y += height;
|
||||
|
||||
size.height = dropdownHeight;
|
||||
|
@ -567,8 +567,8 @@ namespace OpenLoco::Ui::Dropdown
|
|||
common::widgets[0].bottom = dropdownHeight;
|
||||
dropdownHeight++;
|
||||
|
||||
Gfx::ui_size_t size = { dropdownWidth, dropdownHeight };
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Size size = { dropdownWidth, dropdownHeight };
|
||||
Ui::Point origin = { x, y };
|
||||
origin.y += heightOffset;
|
||||
|
||||
size.height = dropdownHeight;
|
||||
|
@ -734,8 +734,8 @@ namespace OpenLoco::Ui::Dropdown
|
|||
common::widgets[0].bottom = dropdownHeight;
|
||||
dropdownHeight++;
|
||||
|
||||
Gfx::ui_size_t size = { static_cast<uint16_t>(width), static_cast<uint16_t>(height) };
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Size size = { static_cast<uint16_t>(width), static_cast<uint16_t>(height) };
|
||||
Ui::Point origin = { x, y };
|
||||
origin.y += height;
|
||||
|
||||
size.height = dropdownHeight;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../Graphics/Types.h"
|
||||
#include "Types.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
|
@ -9,11 +9,11 @@ namespace OpenLoco::Ui
|
|||
class Rect
|
||||
{
|
||||
public:
|
||||
Gfx::ui_size_t size;
|
||||
Gfx::point_t origin;
|
||||
Ui::Size size;
|
||||
Ui::Point32 origin;
|
||||
Rect(int16_t x, int16_t y, uint16_t width, uint16_t height)
|
||||
: size(Gfx::ui_size_t(width, height))
|
||||
, origin(Gfx::point_t(x, y))
|
||||
: size(Ui::Size(width, height))
|
||||
, origin(Ui::Point32(x, y))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -530,7 +530,7 @@ namespace OpenLoco::Ui::ScrollView
|
|||
else
|
||||
{
|
||||
Ui::ScrollView::ScrollPart scrollArea;
|
||||
Gfx::point_t point;
|
||||
Ui::Point point;
|
||||
Ui::ScrollView::getPart(w, widget, x, y, &point.x, &point.y, &scrollArea, &scrollIndex);
|
||||
if (scrollArea != _currentScrollArea)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include "../Math/Vector.hpp"
|
||||
|
||||
namespace OpenLoco::Ui
|
||||
{
|
||||
using Point = Math::Vector::TVector2<int16_t, 1, false>;
|
||||
using Point32 = Math::Vector::TVector2<int32_t, 1, false>;
|
||||
|
||||
// Until interop is removed this is a requirement (for global vars mainly)
|
||||
static_assert(sizeof(Point) == 4);
|
||||
static_assert(sizeof(Point32) == 8);
|
||||
|
||||
struct Size
|
||||
{
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
|
||||
constexpr Size(const uint16_t _width, const uint16_t _height)
|
||||
: width(_width)
|
||||
, height(_height)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
|
@ -412,7 +412,7 @@ namespace OpenLoco::Ui::ViewportInteraction
|
|||
|
||||
// TODO: Handle in the paint functions
|
||||
// Get the viewport and add extra flags for hidden scenery
|
||||
auto screenPos = Gfx::point_t(x, y);
|
||||
auto screenPos = Ui::Point(x, y);
|
||||
auto w = WindowManager::findAt(screenPos);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -453,7 +453,7 @@ namespace OpenLoco::Ui::ViewportInteraction
|
|||
|
||||
_50BF68 = 1;
|
||||
ViewportInteraction::InteractionArg interaction{};
|
||||
Gfx::point_t screenPos = { static_cast<int16_t>(screenX), static_cast<int16_t>(screenY) };
|
||||
Ui::Point screenPos = { static_cast<int16_t>(screenX), static_cast<int16_t>(screenY) };
|
||||
auto w = WindowManager::findAt(screenPos);
|
||||
if (w == nullptr)
|
||||
{
|
||||
|
@ -517,7 +517,7 @@ namespace OpenLoco::Ui::ViewportInteraction
|
|||
// regs.ax = mapX, 0x8000 - in case of failure
|
||||
// regs.bx = mapY
|
||||
// regs.ecx = closestEdge (unsure if ever used)
|
||||
std::optional<Pos2> getSurfaceOrWaterLocFromUi(const xy32& screenCoords)
|
||||
std::optional<Pos2> getSurfaceOrWaterLocFromUi(const Point& screenCoords)
|
||||
{
|
||||
auto [info, viewport] = getMapCoordinatesFromPos(screenCoords.x, screenCoords.y, ~(InteractionItemFlags::surface | InteractionItemFlags::water));
|
||||
|
||||
|
@ -557,7 +557,7 @@ namespace OpenLoco::Ui::ViewportInteraction
|
|||
}
|
||||
|
||||
// 0x0045F1A7
|
||||
std::optional<std::pair<Pos2, Viewport*>> getSurfaceLocFromUi(const xy32& screenCoords)
|
||||
std::optional<std::pair<Pos2, Viewport*>> getSurfaceLocFromUi(const Point& screenCoords)
|
||||
{
|
||||
auto [info, viewport] = getMapCoordinatesFromPos(screenCoords.x, screenCoords.y, ~InteractionItemFlags::surface);
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
0x0045FCE6,
|
||||
[](registers& regs) FORCE_ALIGN_ARG_POINTER -> uint8_t {
|
||||
registers backup = regs;
|
||||
xy32 mouse = { regs.ax, regs.bx };
|
||||
Point mouse = { regs.ax, regs.bx };
|
||||
auto pos = Ui::screenGetMapXyWithZ(mouse, regs.bp);
|
||||
regs = backup;
|
||||
if (pos)
|
||||
|
@ -447,7 +447,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
[](registers& regs) FORCE_ALIGN_ARG_POINTER -> uint8_t {
|
||||
registers backup = regs;
|
||||
|
||||
auto w = createWindow((WindowType)regs.cl, Gfx::point_t(regs.ax, regs.eax >> 16), Gfx::ui_size_t(regs.bx, regs.ebx >> 16), regs.ecx >> 8, (WindowEventList*)regs.edx);
|
||||
auto w = createWindow((WindowType)regs.cl, Ui::Point(regs.ax, regs.eax >> 16), Ui::Size(regs.bx, regs.ebx >> 16), regs.ecx >> 8, (WindowEventList*)regs.edx);
|
||||
regs = backup;
|
||||
|
||||
regs.esi = X86Pointer(w);
|
||||
|
@ -459,7 +459,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
[](registers& regs) FORCE_ALIGN_ARG_POINTER -> uint8_t {
|
||||
registers backup = regs;
|
||||
|
||||
auto w = createWindow((WindowType)regs.cl, Gfx::ui_size_t(regs.bx, (((uint32_t)regs.ebx) >> 16)), regs.ecx >> 8, (WindowEventList*)regs.edx);
|
||||
auto w = createWindow((WindowType)regs.cl, Ui::Size(regs.bx, (((uint32_t)regs.ebx) >> 16)), regs.ecx >> 8, (WindowEventList*)regs.edx);
|
||||
regs = backup;
|
||||
|
||||
regs.esi = X86Pointer(w);
|
||||
|
@ -653,7 +653,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Window* findAt(Gfx::point_t point)
|
||||
Window* findAt(Ui::Point point)
|
||||
{
|
||||
return findAt(point.x, point.y);
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
* @param width @<bx>
|
||||
* @param height @<cx>
|
||||
*/
|
||||
static bool windowFitsWithinSpace(Gfx::point_t position, Gfx::ui_size_t size)
|
||||
static bool windowFitsWithinSpace(Ui::Point position, Ui::Size size)
|
||||
{
|
||||
if (position.x < 0)
|
||||
return false;
|
||||
|
@ -891,8 +891,8 @@ namespace OpenLoco::Ui::WindowManager
|
|||
// 0x004C9F27
|
||||
static Window* createWindowOnScreen(
|
||||
WindowType type,
|
||||
Gfx::point_t origin,
|
||||
Gfx::ui_size_t size,
|
||||
Ui::Point origin,
|
||||
Ui::Size size,
|
||||
uint32_t flags,
|
||||
WindowEventList* events)
|
||||
{
|
||||
|
@ -902,7 +902,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
}
|
||||
|
||||
// 0x004C9BA2
|
||||
static bool windowFitsOnScreen(Gfx::point_t origin, Gfx::ui_size_t size)
|
||||
static bool windowFitsOnScreen(Ui::Point origin, Ui::Size size)
|
||||
{
|
||||
if (origin.x < -(size.width / 4))
|
||||
return false;
|
||||
|
@ -929,11 +929,11 @@ namespace OpenLoco::Ui::WindowManager
|
|||
*/
|
||||
Window* createWindow(
|
||||
WindowType type,
|
||||
Gfx::ui_size_t size,
|
||||
Ui::Size size,
|
||||
uint32_t flags,
|
||||
WindowEventList* events)
|
||||
{
|
||||
Gfx::point_t position{};
|
||||
Ui::Point position{};
|
||||
|
||||
position.x = 0; // dx
|
||||
position.y = 30; // ax
|
||||
|
@ -1057,8 +1057,8 @@ namespace OpenLoco::Ui::WindowManager
|
|||
*/
|
||||
Window* createWindow(
|
||||
WindowType type,
|
||||
Gfx::point_t origin,
|
||||
Gfx::ui_size_t size,
|
||||
Ui::Point origin,
|
||||
Ui::Size size,
|
||||
uint32_t flags,
|
||||
WindowEventList* events)
|
||||
{
|
||||
|
@ -1134,11 +1134,11 @@ namespace OpenLoco::Ui::WindowManager
|
|||
return &_windows[dstIndex];
|
||||
}
|
||||
|
||||
Window* createWindowCentred(WindowType type, Gfx::ui_size_t size, uint32_t flags, WindowEventList* events)
|
||||
Window* createWindowCentred(WindowType type, Ui::Size size, uint32_t flags, WindowEventList* events)
|
||||
{
|
||||
auto x = (Ui::width() / 2) - (size.width / 2);
|
||||
auto y = std::max(28, (Ui::height() / 2) - (size.height / 2));
|
||||
return createWindow(type, Gfx::point_t(x, y), size, flags, events);
|
||||
return createWindow(type, Ui::Point(x, y), size, flags, events);
|
||||
}
|
||||
|
||||
// 0x004C5FC8
|
||||
|
@ -1537,7 +1537,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
return;
|
||||
}
|
||||
|
||||
const Gfx::point_t cursorPosition = Input::getMouseLocation();
|
||||
const Ui::Point cursorPosition = Input::getMouseLocation();
|
||||
auto window = findAt(cursorPosition);
|
||||
|
||||
if (window != nullptr)
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace OpenLoco::Ui::WindowManager
|
|||
Window* find(WindowType type);
|
||||
Window* find(WindowType type, WindowNumber_t number);
|
||||
Window* findAt(int16_t x, int16_t y);
|
||||
Window* findAt(Gfx::point_t point);
|
||||
Window* findAt(Ui::Point point);
|
||||
Window* findAtAlt(int16_t x, int16_t y);
|
||||
Window* bringToFront(Window* window);
|
||||
Window* bringToFront(WindowType type, uint16_t id = 0);
|
||||
|
@ -44,10 +44,10 @@ namespace OpenLoco::Ui::WindowManager
|
|||
void close(WindowType type);
|
||||
void close(WindowType type, uint16_t id);
|
||||
void close(Window* window);
|
||||
Window* createWindow(WindowType type, Gfx::ui_size_t size, uint32_t flags, WindowEventList* events);
|
||||
Window* createWindow(WindowType type, Gfx::point_t origin, Gfx::ui_size_t size, uint32_t flags, WindowEventList* events);
|
||||
Window* createWindowCentred(WindowType type, Gfx::ui_size_t size, uint32_t flags, WindowEventList* events);
|
||||
Window* createWindow(WindowType type, Gfx::ui_size_t size, uint32_t flags, WindowEventList* events);
|
||||
Window* createWindow(WindowType type, Ui::Size size, uint32_t flags, WindowEventList* events);
|
||||
Window* createWindow(WindowType type, Ui::Point origin, Ui::Size size, uint32_t flags, WindowEventList* events);
|
||||
Window* createWindowCentred(WindowType type, Ui::Size size, uint32_t flags, WindowEventList* events);
|
||||
Window* createWindow(WindowType type, Ui::Size size, uint32_t flags, WindowEventList* events);
|
||||
void drawSingle(Gfx::Context* context, Window* w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
||||
void dispatchUpdateAll();
|
||||
void callEvent8OnAllWindows();
|
||||
|
@ -397,8 +397,8 @@ namespace OpenLoco::Ui::Windows
|
|||
namespace Details
|
||||
{
|
||||
Window* open(const Vehicles::VehicleBase* vehicle);
|
||||
void scrollDrag(const Gfx::point_t& pos);
|
||||
void scrollDragEnd(const Gfx::point_t& pos);
|
||||
void scrollDrag(const Ui::Point& pos);
|
||||
void scrollDragEnd(const Ui::Point& pos);
|
||||
}
|
||||
namespace Common
|
||||
{
|
||||
|
|
|
@ -73,10 +73,9 @@ namespace OpenLoco::Ui
|
|||
return viewport_pos(view_x + view_width / 2, view_y + view_height / 2);
|
||||
}
|
||||
|
||||
xy32 Viewport::getUiCentre() const
|
||||
Point Viewport::getUiCentre() const
|
||||
{
|
||||
return { x + width / 2,
|
||||
y + height / 2 };
|
||||
return Point(x + width / 2, y + height / 2);
|
||||
}
|
||||
|
||||
// 0x0045F997
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace OpenLoco::Ui
|
|||
return (vpos.y >= view_y && vpos.y < view_y + view_height && vpos.x >= view_x && vpos.x < view_x + view_width);
|
||||
}
|
||||
|
||||
constexpr bool containsUi(const xy32& pos)
|
||||
constexpr bool containsUi(const Point& pos)
|
||||
{
|
||||
return (pos.x >= x && pos.x < x + width && pos.y >= y && pos.y < y + height);
|
||||
}
|
||||
|
@ -117,17 +117,17 @@ namespace OpenLoco::Ui
|
|||
/**
|
||||
* Maps a 2D viewport position to a UI (screen) position.
|
||||
*/
|
||||
xy32 mapToUi(const viewport_pos& vpos)
|
||||
Point mapToUi(const viewport_pos& vpos)
|
||||
{
|
||||
auto uiX = x + ((vpos.x - view_x) >> zoom);
|
||||
auto uiY = y + ((vpos.y - view_y) >> zoom);
|
||||
return { uiX, uiY };
|
||||
return Point(uiX, uiY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a UI (screen) position to a 2D viewport position.
|
||||
*/
|
||||
viewport_pos uiToMap(const xy32& pos)
|
||||
viewport_pos uiToMap(const Point& pos)
|
||||
{
|
||||
int16_t viewport_x = ((pos.x - x) << zoom) + view_x;
|
||||
int16_t viewport_y = ((pos.y - y) << zoom) + view_y;
|
||||
|
@ -138,8 +138,8 @@ namespace OpenLoco::Ui
|
|||
*/
|
||||
Rect uiToMap(const Rect& rect)
|
||||
{
|
||||
auto leftTop = uiToMap({ rect.left(), rect.top() });
|
||||
auto rightBottom = uiToMap({ rect.right(), rect.bottom() });
|
||||
auto leftTop = uiToMap(Point(rect.left(), rect.top()));
|
||||
auto rightBottom = uiToMap(Point(rect.right(), rect.bottom()));
|
||||
return Rect::fromLTRB(leftTop.x, leftTop.y, rightBottom.x, rightBottom.y);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace OpenLoco::Ui
|
|||
SavedViewSimple toSavedView() const;
|
||||
|
||||
viewport_pos getCentre() const;
|
||||
xy32 getUiCentre() const;
|
||||
Point getUiCentre() const;
|
||||
Map::Pos2 getCentreMapPosition() const;
|
||||
std::optional<Map::Pos2> getCentreScreenMapPosition() const;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenLoco::Ui::ViewportManager
|
|||
_viewports.end());
|
||||
}
|
||||
|
||||
static Viewport* initViewport(Gfx::point_t origin, Gfx::ui_size_t size, ZoomLevel zoom)
|
||||
static Viewport* initViewport(Ui::Point origin, Ui::Size size, ZoomLevel zoom)
|
||||
{
|
||||
auto vp = _viewports.emplace_back(std::make_unique<Viewport>()).get();
|
||||
|
||||
|
@ -139,7 +139,7 @@ namespace OpenLoco::Ui::ViewportManager
|
|||
* 2.
|
||||
* dx : thing_id
|
||||
*/
|
||||
Viewport* create(Window* window, int viewportIndex, Gfx::point_t origin, Gfx::ui_size_t size, ZoomLevel zoom, EntityId_t thing_id)
|
||||
Viewport* create(Window* window, int viewportIndex, Ui::Point origin, Ui::Size size, ZoomLevel zoom, EntityId_t thing_id)
|
||||
{
|
||||
Viewport* viewport = initViewport(origin, size, zoom);
|
||||
|
||||
|
@ -168,7 +168,7 @@ namespace OpenLoco::Ui::ViewportManager
|
|||
* 2.
|
||||
* dx : thing_id
|
||||
*/
|
||||
Viewport* create(Window* window, int viewportIndex, Gfx::point_t origin, Gfx::ui_size_t size, ZoomLevel zoom, Map::Pos3 tile)
|
||||
Viewport* create(Window* window, int viewportIndex, Ui::Point origin, Ui::Size size, ZoomLevel zoom, Map::Pos3 tile)
|
||||
{
|
||||
Viewport* viewport = initViewport(origin, size, zoom);
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace OpenLoco::Ui::ViewportManager
|
|||
void init();
|
||||
void registerHooks();
|
||||
void collectGarbage();
|
||||
Viewport* create(Window* window, int viewportIndex, Gfx::point_t origin, Gfx::ui_size_t size, ZoomLevel zoom, EntityId_t thing_id);
|
||||
Viewport* create(Window* window, int viewportIndex, Gfx::point_t origin, Gfx::ui_size_t size, ZoomLevel zoom, Map::Pos3 tile);
|
||||
Viewport* create(Window* window, int viewportIndex, Ui::Point origin, Ui::Size size, ZoomLevel zoom, EntityId_t thing_id);
|
||||
Viewport* create(Window* window, int viewportIndex, Ui::Point origin, Ui::Size size, ZoomLevel zoom, Map::Pos3 tile);
|
||||
void invalidate(Station* station);
|
||||
void invalidate(EntityBase* t, ZoomLevel zoom);
|
||||
void invalidate(Map::Pos2 pos, coord_t zMin, coord_t zMax, ZoomLevel zoom = ZoomLevel::eighth, int radius = 32);
|
||||
|
|
|
@ -963,7 +963,7 @@ namespace OpenLoco::Ui
|
|||
{
|
||||
auto widget = &w->widgets[index];
|
||||
|
||||
Gfx::point_t pos = {};
|
||||
Ui::Point pos = {};
|
||||
pos.x = widget->left + w->x;
|
||||
pos.y = widget->top + w->y;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenLoco::Ui
|
|||
#pragma pack(pop)
|
||||
static_assert(sizeof(Widget) == 0x10);
|
||||
|
||||
static constexpr Widget makeWidget(Gfx::point_t origin, Gfx::ui_size_t size, WidgetType type, WindowColour colour, uint32_t content = 0xFFFFFFFF, string_id tooltip = StringIds::null)
|
||||
static constexpr Widget makeWidget(Ui::Point origin, Ui::Size size, WidgetType type, WindowColour colour, uint32_t content = 0xFFFFFFFF, string_id tooltip = StringIds::null)
|
||||
{
|
||||
Widget out = {};
|
||||
out.left = origin.x;
|
||||
|
@ -78,7 +78,7 @@ namespace OpenLoco::Ui
|
|||
return out;
|
||||
}
|
||||
|
||||
constexpr Widget makeRemapWidget(Gfx::point_t origin, Gfx::ui_size_t size, WidgetType type, WindowColour colour, uint32_t content = 0xFFFFFFFF, string_id tooltip = StringIds::null)
|
||||
constexpr Widget makeRemapWidget(Ui::Point origin, Ui::Size size, WidgetType type, WindowColour colour, uint32_t content = 0xFFFFFFFF, string_id tooltip = StringIds::null)
|
||||
{
|
||||
Widget out = makeWidget(origin, size, type, colour, content, tooltip);
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace OpenLoco::Ui
|
|||
makeWidget(__VA_ARGS__), \
|
||||
makeDropdownButtonWidget(__VA_ARGS__)
|
||||
|
||||
[[maybe_unused]] static constexpr Widget makeDropdownButtonWidget(Gfx::point_t origin, Gfx::ui_size_t size, [[maybe_unused]] WidgetType type, WindowColour colour, [[maybe_unused]] uint32_t content = 0xFFFFFFFF, [[maybe_unused]] string_id tooltip = StringIds::null)
|
||||
[[maybe_unused]] static constexpr Widget makeDropdownButtonWidget(Ui::Point origin, Ui::Size size, [[maybe_unused]] WidgetType type, WindowColour colour, [[maybe_unused]] uint32_t content = 0xFFFFFFFF, [[maybe_unused]] string_id tooltip = StringIds::null)
|
||||
{
|
||||
const int16_t xPos = origin.x + size.width - 12;
|
||||
const int16_t yPos = origin.y + 1;
|
||||
|
@ -107,7 +107,7 @@ namespace OpenLoco::Ui
|
|||
makeStepperDecreaseWidget(__VA_ARGS__), \
|
||||
makeStepperIncreaseWidget(__VA_ARGS__)
|
||||
|
||||
[[maybe_unused]] static constexpr Widget makeStepperDecreaseWidget(Gfx::point_t origin, Gfx::ui_size_t size, [[maybe_unused]] WidgetType type, WindowColour colour, [[maybe_unused]] uint32_t content = 0xFFFFFFFF, [[maybe_unused]] string_id tooltip = StringIds::null)
|
||||
[[maybe_unused]] static constexpr Widget makeStepperDecreaseWidget(Ui::Point origin, Ui::Size size, [[maybe_unused]] WidgetType type, WindowColour colour, [[maybe_unused]] uint32_t content = 0xFFFFFFFF, [[maybe_unused]] string_id tooltip = StringIds::null)
|
||||
{
|
||||
const int16_t xPos = origin.x + size.width - 26;
|
||||
const int16_t yPos = origin.y + 1;
|
||||
|
@ -117,7 +117,7 @@ namespace OpenLoco::Ui
|
|||
return makeWidget({ xPos, yPos }, { width, height }, WidgetType::wt_11, colour, StringIds::stepper_minus);
|
||||
}
|
||||
|
||||
[[maybe_unused]] static constexpr Widget makeStepperIncreaseWidget(Gfx::point_t origin, Gfx::ui_size_t size, [[maybe_unused]] WidgetType type, WindowColour colour, [[maybe_unused]] uint32_t content = 0xFFFFFFFF, [[maybe_unused]] string_id tooltip = StringIds::null)
|
||||
[[maybe_unused]] static constexpr Widget makeStepperIncreaseWidget(Ui::Point origin, Ui::Size size, [[maybe_unused]] WidgetType type, WindowColour colour, [[maybe_unused]] uint32_t content = 0xFFFFFFFF, [[maybe_unused]] string_id tooltip = StringIds::null)
|
||||
{
|
||||
const int16_t xPos = origin.x + size.width - 13;
|
||||
const int16_t yPos = origin.y + 1;
|
||||
|
@ -127,7 +127,7 @@ namespace OpenLoco::Ui
|
|||
return makeWidget({ xPos, yPos }, { width, height }, WidgetType::wt_11, colour, StringIds::stepper_plus);
|
||||
}
|
||||
|
||||
constexpr Widget makeTextWidget(Gfx::point_t origin, Gfx::ui_size_t size, WidgetType type, WindowColour colour, string_id content, string_id tooltip = StringIds::null)
|
||||
constexpr Widget makeTextWidget(Ui::Point origin, Ui::Size size, WidgetType type, WindowColour colour, string_id content, string_id tooltip = StringIds::null)
|
||||
{
|
||||
Widget out = {};
|
||||
out.left = origin.x;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace OpenLoco::Ui
|
|||
return (uint32_t)e < 0x004D7000;
|
||||
}
|
||||
|
||||
Window::Window(Gfx::point_t position, Gfx::ui_size_t size)
|
||||
Window::Window(Ui::Point position, Ui::Size size)
|
||||
: x(position.x)
|
||||
, y(position.y)
|
||||
, width(size.width)
|
||||
|
@ -125,7 +125,7 @@ namespace OpenLoco::Ui
|
|||
// regs.bp: z
|
||||
// Output:
|
||||
// {x: regs.ax, y: regs.bx}
|
||||
std::optional<Map::Pos2> screenGetMapXyWithZ(const xy32& mouse, const int16_t z)
|
||||
std::optional<Map::Pos2> screenGetMapXyWithZ(const Point& mouse, const int16_t z)
|
||||
{
|
||||
Window* w = WindowManager::findAt(mouse.x, mouse.y);
|
||||
if (w == nullptr)
|
||||
|
@ -809,7 +809,7 @@ namespace OpenLoco::Ui
|
|||
// 0x004CD320
|
||||
void Window::moveInsideScreenEdges()
|
||||
{
|
||||
Gfx::point_t offset = { 0, 0 };
|
||||
Ui::Point offset = { 0, 0 };
|
||||
|
||||
const int16_t xOvershoot = this->x + this->width - Ui::width();
|
||||
|
||||
|
@ -831,7 +831,7 @@ namespace OpenLoco::Ui
|
|||
if (this->y - 28 < 0)
|
||||
offset.y -= this->y - 28;
|
||||
|
||||
if (offset == 0)
|
||||
if (offset == Ui::Point(0, 0))
|
||||
return;
|
||||
|
||||
this->invalidate();
|
||||
|
|
|
@ -298,9 +298,9 @@ namespace OpenLoco::Ui
|
|||
int16_t var_88A;
|
||||
int16_t var_88C;
|
||||
|
||||
Window(Gfx::point_t position, Gfx::ui_size_t size);
|
||||
Window(Ui::Point position, Ui::Size size);
|
||||
|
||||
constexpr bool setSize(Gfx::ui_size_t minSize, Gfx::ui_size_t maxSize)
|
||||
constexpr bool setSize(Ui::Size minSize, Ui::Size maxSize)
|
||||
{
|
||||
bool hasResized = false;
|
||||
|
||||
|
@ -338,7 +338,7 @@ namespace OpenLoco::Ui
|
|||
return hasResized;
|
||||
}
|
||||
|
||||
constexpr void setSize(Gfx::ui_size_t size)
|
||||
constexpr void setSize(Ui::Size size)
|
||||
{
|
||||
setSize(size, size);
|
||||
}
|
||||
|
@ -433,6 +433,6 @@ namespace OpenLoco::Ui
|
|||
assert_struct_size(Window, 0x88E);
|
||||
|
||||
Map::Pos2 viewportCoordToMapCoord(int16_t x, int16_t y, int16_t z, int32_t rotation);
|
||||
std::optional<Map::Pos2> screenGetMapXyWithZ(const xy32& mouse, const int16_t z);
|
||||
std::optional<Map::Pos2> screenGetMapXyWithZ(const Point& mouse, const int16_t z);
|
||||
#pragma pack(pop)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace OpenLoco::Ui::Windows::About
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 400, 260 };
|
||||
constexpr Ui::Size windowSize = { 400, 260 };
|
||||
|
||||
namespace widx
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::AboutMusic
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 500, 312 };
|
||||
constexpr Ui::Size windowSize = { 500, 312 };
|
||||
|
||||
constexpr uint16_t numSongs = 31;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::BuildVehicle
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 380, 233 };
|
||||
static const Ui::Size window_size = { 380, 233 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -242,8 +242,8 @@ namespace OpenLoco::Ui::Windows::BuildVehicle
|
|||
static void resetTrackTypeTabSelection(Ui::Window* window);
|
||||
static void setTopToolbarLastTrack(uint8_t trackType, bool isRoad);
|
||||
static void setTransportTypeTabs(Ui::Window* window);
|
||||
static void drawVehicleOverview(Gfx::Context* context, int16_t vehicleTypeIdx, CompanyId_t company, uint8_t eax, uint8_t esi, Gfx::point_t offset);
|
||||
static int16_t drawVehicleInline(Gfx::Context* context, int16_t vehicleTypeIdx, uint8_t unk_1, CompanyId_t company, Gfx::point_t loc);
|
||||
static void drawVehicleOverview(Gfx::Context* context, int16_t vehicleTypeIdx, CompanyId_t company, uint8_t eax, uint8_t esi, Ui::Point offset);
|
||||
static int16_t drawVehicleInline(Gfx::Context* context, int16_t vehicleTypeIdx, uint8_t unk_1, CompanyId_t company, Ui::Point loc);
|
||||
static void drawTransportTypeTabs(Ui::Window* window, Gfx::Context* context);
|
||||
static void drawTrackTypeTabs(Ui::Window* window, Gfx::Context* context);
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ namespace OpenLoco::Ui::Windows::BuildVehicle
|
|||
}
|
||||
|
||||
// 0x4B7741
|
||||
static void drawVehicleOverview(Gfx::Context* context, int16_t vehicleTypeIdx, CompanyId_t company, uint8_t eax, uint8_t esi, Gfx::point_t offset)
|
||||
static void drawVehicleOverview(Gfx::Context* context, int16_t vehicleTypeIdx, CompanyId_t company, uint8_t eax, uint8_t esi, Ui::Point offset)
|
||||
{
|
||||
registers regs;
|
||||
regs.cx = offset.x;
|
||||
|
@ -1407,7 +1407,7 @@ namespace OpenLoco::Ui::Windows::BuildVehicle
|
|||
}
|
||||
|
||||
// 0x4B7711
|
||||
static int16_t drawVehicleInline(Gfx::Context* context, int16_t vehicleTypeIdx, uint8_t unk_1, CompanyId_t company, Gfx::point_t loc)
|
||||
static int16_t drawVehicleInline(Gfx::Context* context, int16_t vehicleTypeIdx, uint8_t unk_1, CompanyId_t company, Ui::Point loc)
|
||||
{
|
||||
registers regs;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace OpenLoco::Ui::Windows::Cheats
|
|||
|
||||
namespace Finances
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 250, 124 };
|
||||
constexpr Ui::Size windowSize = { 250, 124 };
|
||||
|
||||
static WindowEventList _events;
|
||||
|
||||
|
@ -288,7 +288,7 @@ namespace OpenLoco::Ui::Windows::Cheats
|
|||
|
||||
namespace Companies
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 250, 172 };
|
||||
constexpr Ui::Size windowSize = { 250, 172 };
|
||||
|
||||
static WindowEventList _events;
|
||||
|
||||
|
@ -438,7 +438,7 @@ namespace OpenLoco::Ui::Windows::Cheats
|
|||
|
||||
namespace Vehicles
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 250, 103 };
|
||||
constexpr Ui::Size windowSize = { 250, 103 };
|
||||
|
||||
static WindowEventList _events;
|
||||
|
||||
|
@ -525,7 +525,7 @@ namespace OpenLoco::Ui::Windows::Cheats
|
|||
|
||||
namespace Towns
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 250, 103 };
|
||||
constexpr Ui::Size windowSize = { 250, 103 };
|
||||
|
||||
static WindowEventList _events;
|
||||
|
||||
|
@ -664,7 +664,7 @@ namespace OpenLoco::Ui::Windows::Cheats
|
|||
WindowEventList* events;
|
||||
const uint64_t* enabledWidgets;
|
||||
const uint64_t* holdableWidgets;
|
||||
Gfx::ui_size_t windowSize;
|
||||
Ui::Size windowSize;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace OpenLoco::Ui::Windows::CompanyFaceSelection
|
|||
static loco_global<CompetitorObject*, 0x0050D15C> _loadedObject; // This could be any type of object
|
||||
static loco_global<int32_t, 0x0113E72C> _cursorX;
|
||||
|
||||
static const Gfx::ui_size_t windowSize = { 400, 272 };
|
||||
static const Ui::Size windowSize = { 400, 272 };
|
||||
static constexpr uint32_t rowHeight = 10;
|
||||
static WindowEventList events;
|
||||
|
||||
|
|
|
@ -99,9 +99,9 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
namespace CompanyList
|
||||
{
|
||||
static const Gfx::ui_size_t maxWindowSize = { 640, 470 };
|
||||
static const Gfx::ui_size_t minWindowSize = { 300, 272 };
|
||||
static const Gfx::ui_size_t windowSize = { 640, 272 };
|
||||
static const Ui::Size maxWindowSize = { 640, 470 };
|
||||
static const Ui::Size minWindowSize = { 300, 272 };
|
||||
static const Ui::Size windowSize = { 640, 272 };
|
||||
|
||||
static const uint8_t rowHeight = 25;
|
||||
|
||||
|
@ -585,7 +585,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
if (window == nullptr)
|
||||
{
|
||||
Gfx::ui_size_t windowSize = { 640, 272 };
|
||||
Ui::Size windowSize = { 640, 272 };
|
||||
|
||||
window = WindowManager::createWindow(WindowType::companyList, windowSize, 0, &CompanyList::events);
|
||||
|
||||
|
@ -634,7 +634,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
namespace CompanyPerformance
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 635, 322 };
|
||||
static const Ui::Size windowSize = { 635, 322 };
|
||||
|
||||
const uint64_t enabledWidgets = Common::enabledWidgets;
|
||||
|
||||
|
@ -725,7 +725,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
namespace CargoUnits
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 640, 272 };
|
||||
static const Ui::Size windowSize = { 640, 272 };
|
||||
|
||||
const uint64_t enabledWidgets = Common::enabledWidgets;
|
||||
|
||||
|
@ -816,7 +816,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
namespace CargoDistance
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 660, 272 };
|
||||
static const Ui::Size windowSize = { 660, 272 };
|
||||
|
||||
const uint64_t enabledWidgets = Common::enabledWidgets;
|
||||
|
||||
|
@ -907,7 +907,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
namespace CompanyValues
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 685, 322 };
|
||||
static const Ui::Size windowSize = { 685, 322 };
|
||||
|
||||
const uint64_t enabledWidgets = Common::enabledWidgets;
|
||||
|
||||
|
@ -998,7 +998,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
namespace CargoPaymentRates
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 495, 342 };
|
||||
static const Ui::Size windowSize = { 495, 342 };
|
||||
|
||||
const uint64_t enabledWidgets = Common::enabledWidgets;
|
||||
|
||||
|
@ -1219,7 +1219,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
|
||||
namespace CompanySpeedRecords
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 495, 169 };
|
||||
static const Ui::Size windowSize = { 495, 169 };
|
||||
|
||||
const uint64_t enabledWidgets = Common::enabledWidgets;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
|
||||
namespace Status
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 270, 182 };
|
||||
static const Ui::Size windowSize = { 270, 182 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
{
|
||||
auto args = FormatArguments::common(company->owner_name);
|
||||
auto& widget = self->widgets[widx::change_owner_name];
|
||||
auto origin = Gfx::point_t(self->x + (widget.left + widget.right) / 2, self->y + widget.top + 5);
|
||||
auto origin = Ui::Point(self->x + (widget.left + widget.right) / 2, self->y + widget.top + 5);
|
||||
Gfx::drawStringCentredWrapped(
|
||||
*context,
|
||||
origin,
|
||||
|
@ -376,11 +376,11 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
{
|
||||
Common::enableRenameByCaption(self);
|
||||
|
||||
self->setSize(Status::windowSize, Gfx::ui_size_t(640, 400));
|
||||
self->setSize(Status::windowSize, Ui::Size(640, 400));
|
||||
|
||||
if (self->viewports[0] != nullptr)
|
||||
{
|
||||
Gfx::ui_size_t proposedDims(self->width - 123, self->height - 59);
|
||||
Ui::Size proposedDims(self->width - 123, self->height - 59);
|
||||
auto& viewport = self->viewports[0];
|
||||
if (proposedDims.width != viewport->width || proposedDims.height != viewport->height)
|
||||
{
|
||||
|
@ -403,8 +403,8 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
}
|
||||
|
||||
auto& widget = self->widgets[widx::viewport];
|
||||
auto origin = Gfx::point_t(widget.left + self->x + 1, widget.top + self->y + 1);
|
||||
auto size = Gfx::ui_size_t(widget.width() - 2, widget.height() - 2);
|
||||
auto origin = Ui::Point(widget.left + self->x + 1, widget.top + self->y + 1);
|
||||
auto size = Ui::Size(widget.width() - 2, widget.height() - 2);
|
||||
if (view.isThingView())
|
||||
{
|
||||
ViewportManager::create(self, 0, origin, size, self->saved_view.zoomLevel, view.thingId);
|
||||
|
@ -636,7 +636,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
|
||||
namespace Details
|
||||
{
|
||||
const Gfx::ui_size_t windowSize = { 340, 194 };
|
||||
const Ui::Size windowSize = { 340, 194 };
|
||||
|
||||
loco_global<Map::Pos3, 0x009C68D6> _headquarterGhostPos;
|
||||
loco_global<uint8_t, 0x009C68F0> _headquarterGhostRotation;
|
||||
|
@ -816,7 +816,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
if (company->headquarters_x == -1)
|
||||
{
|
||||
auto width = self->widgets[widx::viewport].width();
|
||||
Gfx::point_t loc = {
|
||||
Ui::Point loc = {
|
||||
static_cast<int16_t>(self->x + self->widgets[widx::viewport].left + width / 2),
|
||||
static_cast<int16_t>(self->y + self->widgets[widx::viewport].top + self->widgets[widx::viewport].height() / 2 - 5)
|
||||
};
|
||||
|
@ -1067,8 +1067,8 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
}
|
||||
|
||||
auto& widget = self->widgets[widx::viewport];
|
||||
auto origin = Gfx::point_t(widget.left + self->x + 1, widget.top + self->y + 1);
|
||||
auto size = Gfx::ui_size_t(widget.width() - 2, widget.height() - 2);
|
||||
auto origin = Ui::Point(widget.left + self->x + 1, widget.top + self->y + 1);
|
||||
auto size = Ui::Size(widget.width() - 2, widget.height() - 2);
|
||||
|
||||
ViewportManager::create(self, 0, origin, size, self->saved_view.zoomLevel, view.getPos());
|
||||
self->flags |= WindowFlags::viewport_no_scrolling;
|
||||
|
@ -1152,7 +1152,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
|
||||
namespace ColourScheme
|
||||
{
|
||||
const Gfx::ui_size_t windowSize = { 265, 252 };
|
||||
const Ui::Size windowSize = { 265, 252 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -1594,7 +1594,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
|
||||
namespace Finances
|
||||
{
|
||||
const Gfx::ui_size_t windowSize = { 636, 319 };
|
||||
const Ui::Size windowSize = { 636, 319 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -2096,7 +2096,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
|
||||
namespace CargoDelivered
|
||||
{
|
||||
const Gfx::ui_size_t windowSize = { 240, 382 };
|
||||
const Ui::Size windowSize = { 240, 382 };
|
||||
|
||||
static Widget widgets[] = {
|
||||
commonWidgets(240, 382, StringIds::title_company_cargo_delivered),
|
||||
|
@ -2286,7 +2286,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
static loco_global<uint16_t, 0x00526243> objectiveMonthsInChallenge;
|
||||
static loco_global<uint16_t, 0x00526245> objectiveCompletedChallengeInMonths;
|
||||
|
||||
const Gfx::ui_size_t windowSize = { 320, 182 };
|
||||
const Ui::Size windowSize = { 320, 182 };
|
||||
|
||||
static Widget widgets[] = {
|
||||
commonWidgets(320, 182, StringIds::title_company_challenge),
|
||||
|
@ -2506,7 +2506,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
const widx widgetIndex;
|
||||
WindowEventList* events;
|
||||
const uint64_t* enabledWidgets;
|
||||
const Gfx::ui_size_t* windowSize;
|
||||
const Ui::Size* windowSize;
|
||||
};
|
||||
|
||||
static TabInformation tabInformationByTabOffset[] = {
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace OpenLoco::Ui::Windows::Construction
|
|||
|
||||
namespace Construction
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 138, 276 };
|
||||
static const Ui::Size windowSize = { 138, 276 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
|
|
@ -1653,7 +1653,7 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
|
|||
|
||||
if (height)
|
||||
{
|
||||
mapPos = screenGetMapXyWithZ(xy32(x, y), height->first);
|
||||
mapPos = screenGetMapXyWithZ(Point(x, y), height->first);
|
||||
if (mapPos)
|
||||
{
|
||||
mapPos->x &= 0xFFE0;
|
||||
|
@ -1749,7 +1749,7 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
|
|||
{
|
||||
if (_word_4F7B62[height->second] == 0)
|
||||
{
|
||||
mapPos = screenGetMapXyWithZ(xy32(x, y), height->first);
|
||||
mapPos = screenGetMapXyWithZ(Point(x, y), height->first);
|
||||
if (mapPos)
|
||||
{
|
||||
mapPos->x &= 0xFFE0;
|
||||
|
@ -1901,7 +1901,7 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
|
|||
}
|
||||
|
||||
// 0x0049D106
|
||||
static void drawTrackCost(Window* self, Gfx::Context* clipped, Gfx::Context* context, xy32 pos, uint16_t width, uint16_t height)
|
||||
static void drawTrackCost(Window* self, Gfx::Context* clipped, Gfx::Context* context, Point pos, uint16_t width, uint16_t height)
|
||||
{
|
||||
width >>= 1;
|
||||
height >>= 1;
|
||||
|
@ -1922,7 +1922,7 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
|
|||
}
|
||||
|
||||
// 0x0049D325
|
||||
static void drawRoadCost(Window* self, Gfx::Context* clipped, Gfx::Context* context, xy32 pos, uint16_t width, uint16_t height)
|
||||
static void drawRoadCost(Window* self, Gfx::Context* clipped, Gfx::Context* context, Point pos, uint16_t width, uint16_t height)
|
||||
{
|
||||
width >>= 1;
|
||||
height >>= 1;
|
||||
|
@ -2010,7 +2010,7 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
|
|||
pos3D.z += 0x1CC;
|
||||
|
||||
auto pos2D = gameToScreen(pos3D, gCurrentRotation);
|
||||
xy32 pos = { pos2D.x, pos2D.y };
|
||||
Point pos = { pos2D.x, pos2D.y };
|
||||
drawRoadCost(self, clipped, context, pos, width, height);
|
||||
}
|
||||
else
|
||||
|
@ -2060,7 +2060,7 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
|
|||
pos3D.z += 0x1CC;
|
||||
|
||||
auto pos2D = gameToScreen(pos3D, gCurrentRotation);
|
||||
xy32 pos = { pos2D.x, pos2D.y };
|
||||
Point pos = { pos2D.x, pos2D.y };
|
||||
drawTrackCost(self, clipped, context, pos, width, height);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace OpenLoco::Ui::Windows::Construction::Overhead
|
|||
coord_t y = 0x2010;
|
||||
|
||||
auto rotCoord = Math::Vector::rotate(Pos2{ x, y }, gCurrentRotation);
|
||||
Gfx::point_t screenPos = { static_cast<int16_t>(rotCoord.y - rotCoord.x), static_cast<int16_t>(((rotCoord.x + rotCoord.y) >> 1) - 460) };
|
||||
Ui::Point screenPos = { static_cast<int16_t>(rotCoord.y - rotCoord.x), static_cast<int16_t>(((rotCoord.x + rotCoord.y) >> 1) - 460) };
|
||||
|
||||
screenPos.x -= (self->widgets[widx::image].width() / 2);
|
||||
screenPos.y -= ((self->widgets[widx::image].width() / 2) + 16);
|
||||
|
|
|
@ -326,7 +326,7 @@ namespace OpenLoco::Ui::Windows::Construction::Station
|
|||
|
||||
xPos = self->x + 2;
|
||||
yPos = self->widgets[widx::image].bottom + self->y + 29;
|
||||
Gfx::point_t origin = { xPos, yPos };
|
||||
Ui::Point origin = { xPos, yPos };
|
||||
|
||||
Gfx::drawString_494B3F(*context, &origin, Colour::black, StringIds::catchment_area_accepts);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenLoco::Ui::Windows::DragVehiclePart
|
|||
auto pos = Input::getTooltipMouseLocation();
|
||||
pos.y -= 30;
|
||||
pos.x -= width / 2;
|
||||
Gfx::ui_size_t size = { width, 60 };
|
||||
Ui::Size size = { width, 60 };
|
||||
auto self = WindowManager::createWindow(WindowType::dragVehiclePart, pos, size, WindowFlags::transparent | WindowFlags::stick_to_front, &events);
|
||||
self->widgets = widgets;
|
||||
self->widgets[widx::frame].right = width - 1;
|
||||
|
|
|
@ -16,7 +16,7 @@ using namespace OpenLoco::Input;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::EditKeyboardShortcut
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 280, 72 };
|
||||
constexpr Ui::Size windowSize = { 280, 72 };
|
||||
|
||||
static WindowEventList events;
|
||||
static loco_global<uint8_t, 0x011364A4> _11364A4;
|
||||
|
@ -71,7 +71,7 @@ namespace OpenLoco::Ui::Windows::EditKeyboardShortcut
|
|||
|
||||
FormatArguments args{};
|
||||
args.push(ShortcutManager::getName(static_cast<Shortcut>(*_11364A4)));
|
||||
auto point = Gfx::point_t(self->x + 140, self->y + 32);
|
||||
auto point = Ui::Point(self->x + 140, self->y + 32);
|
||||
Gfx::drawStringCentredWrapped(*ctx, point, 272, 0, StringIds::change_keyboard_shortcut_desc, &args);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,11 +137,11 @@ namespace OpenLoco::Ui::Windows::Error
|
|||
|
||||
x = std::clamp(_cursorX - (width / 2), 0, Ui::width() - width);
|
||||
|
||||
Gfx::ui_size_t windowSize = { width, height };
|
||||
Ui::Size windowSize = { width, height };
|
||||
|
||||
auto error = WindowManager::createWindow(
|
||||
WindowType::error,
|
||||
Gfx::point_t(x, y),
|
||||
Ui::Point(x, y),
|
||||
windowSize,
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::flag_7,
|
||||
&Common::events);
|
||||
|
|
|
@ -69,9 +69,9 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
|
||||
namespace IndustryList
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 600, 197 };
|
||||
static const Gfx::ui_size_t maxDimensions = { 600, 900 };
|
||||
static const Gfx::ui_size_t minDimensions = { 192, 100 };
|
||||
static const Ui::Size windowSize = { 600, 197 };
|
||||
static const Ui::Size maxDimensions = { 600, 900 };
|
||||
static const Ui::Size minDimensions = { 192, 100 };
|
||||
|
||||
static const uint8_t rowHeight = 10;
|
||||
|
||||
|
@ -517,7 +517,7 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
else
|
||||
{
|
||||
// 0x00457878
|
||||
auto origin = Gfx::point_t(Ui::width() - IndustryList::windowSize.width, 30);
|
||||
auto origin = Ui::Point(Ui::width() - IndustryList::windowSize.width, 30);
|
||||
|
||||
window = WindowManager::createWindow(
|
||||
WindowType::industryList,
|
||||
|
@ -573,7 +573,7 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
namespace NewIndustries
|
||||
{
|
||||
|
||||
static const Gfx::ui_size_t window_size = { 578, 172 };
|
||||
static const Ui::Size window_size = { 578, 172 };
|
||||
|
||||
static const uint8_t rowHeight = 112;
|
||||
|
||||
|
@ -1148,8 +1148,8 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
static void onResize(Window* self)
|
||||
{
|
||||
self->invalidate();
|
||||
Gfx::ui_size_t minWindowSize = { self->min_width, self->min_height };
|
||||
Gfx::ui_size_t maxWindowSize = { self->max_width, self->max_height };
|
||||
Ui::Size minWindowSize = { self->min_width, self->min_height };
|
||||
Ui::Size maxWindowSize = { self->max_width, self->max_height };
|
||||
bool hasResized = self->setSize(minWindowSize, maxWindowSize);
|
||||
if (hasResized)
|
||||
updateActiveThumb(self);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "../Graphics/Colour.h"
|
||||
#include "../Graphics/Gfx.h"
|
||||
#include "../Graphics/ImageIds.h"
|
||||
#include "../Graphics/Types.h"
|
||||
#include "../IndustryManager.h"
|
||||
#include "../Input.h"
|
||||
#include "../Interop/Interop.hpp"
|
||||
|
@ -68,11 +67,11 @@ namespace OpenLoco::Ui::Windows::Industry
|
|||
|
||||
namespace Industry
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 223, 137 };
|
||||
static const Ui::Size windowSize = { 223, 137 };
|
||||
|
||||
static const Gfx::ui_size_t minWindowSize = { 192, 137 };
|
||||
static const Ui::Size minWindowSize = { 192, 137 };
|
||||
|
||||
static const Gfx::ui_size_t maxWindowSize = { 600, 440 };
|
||||
static const Ui::Size maxWindowSize = { 600, 440 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -261,8 +260,8 @@ namespace OpenLoco::Ui::Windows::Industry
|
|||
{
|
||||
auto widget = &self->widgets[widx::viewport];
|
||||
auto tile = Map::Pos3({ industry->x, industry->y, tileZ });
|
||||
auto origin = Gfx::point_t(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Gfx::ui_size_t(widget->width() - 2, widget->height() - 2);
|
||||
auto origin = Ui::Point(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Ui::Size(widget->width() - 2, widget->height() - 2);
|
||||
ViewportManager::create(self, 0, origin, size, self->saved_view.zoomLevel, tile);
|
||||
self->invalidate();
|
||||
self->flags |= WindowFlags::viewport_no_scrolling;
|
||||
|
@ -344,9 +343,9 @@ namespace OpenLoco::Ui::Windows::Industry
|
|||
namespace Production
|
||||
{
|
||||
|
||||
static const Gfx::ui_size_t minWindowSize = { 299, 282 };
|
||||
static const Ui::Size minWindowSize = { 299, 282 };
|
||||
|
||||
static const Gfx::ui_size_t maxWindowSize = { 299, 337 };
|
||||
static const Ui::Size maxWindowSize = { 299, 337 };
|
||||
|
||||
static WindowEventList events;
|
||||
|
||||
|
@ -379,9 +378,9 @@ namespace OpenLoco::Ui::Windows::Industry
|
|||
|
||||
namespace Production2
|
||||
{
|
||||
static const Gfx::ui_size_t minWindowSize = { 299, 282 };
|
||||
static const Ui::Size minWindowSize = { 299, 282 };
|
||||
|
||||
static const Gfx::ui_size_t maxWindowSize = { 299, 337 };
|
||||
static const Ui::Size maxWindowSize = { 299, 337 };
|
||||
|
||||
static Widget widgets[] = {
|
||||
commonWidgets(222, 136, StringIds::title_industry_monthly_production),
|
||||
|
@ -419,7 +418,7 @@ namespace OpenLoco::Ui::Windows::Industry
|
|||
|
||||
namespace Transported
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 300, 127 };
|
||||
static const Ui::Size windowSize = { 300, 127 };
|
||||
|
||||
static Widget widgets[] = {
|
||||
commonWidgets(300, 126, StringIds::title_statistics),
|
||||
|
@ -446,7 +445,7 @@ namespace OpenLoco::Ui::Windows::Industry
|
|||
auto industryObj = industry->object();
|
||||
int16_t xPos = self->x + 3;
|
||||
int16_t yPos = self->y + 45;
|
||||
Gfx::point_t origin = { xPos, yPos };
|
||||
Ui::Point origin = { xPos, yPos };
|
||||
|
||||
// Draw Last Months received cargo stats
|
||||
if (industry->canReceiveCargo())
|
||||
|
|
|
@ -19,8 +19,8 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::LandscapeGeneration
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 366, 217 };
|
||||
static const Gfx::ui_size_t land_tab_size = { 366, 247 };
|
||||
static const Ui::Size window_size = { 366, 217 };
|
||||
static const Ui::Size land_tab_size = { 366, 247 };
|
||||
|
||||
static const uint8_t rowHeight = 22; // CJK: 22
|
||||
|
||||
|
@ -1319,7 +1319,7 @@ namespace OpenLoco::Ui::Windows::LandscapeGeneration
|
|||
|
||||
window->invalidate();
|
||||
|
||||
const Gfx::ui_size_t* newSize = &window_size;
|
||||
const Ui::Size* newSize = &window_size;
|
||||
if (widgetIndex == widx::tab_land)
|
||||
newSize = &land_tab_size;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::LandscapeGenerationConfirm
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 280, 92 };
|
||||
static const Ui::Size window_size = { 280, 92 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ namespace OpenLoco::Ui::Windows::LandscapeGenerationConfirm
|
|||
string_id prompt = window->var_846 == 0 ? StringIds::prompt_confirm_generate_landscape : StringIds::prompt_confirm_random_landscape;
|
||||
*commonFormatArgs = prompt;
|
||||
|
||||
auto origin = Gfx::point_t(window->x + (window->width / 2), window->y + 41);
|
||||
auto origin = Ui::Point(window->x + (window->width / 2), window->y + 41);
|
||||
Gfx::drawStringCentredWrapped(*context, origin, window->width, Colour::black, StringIds::wcolour2_stringid, (const char*)&*commonFormatArgs);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenLoco::Ui::Windows::Main
|
|||
auto window = WindowManager::createWindow(
|
||||
WindowType::main,
|
||||
{ 0, 0 },
|
||||
Gfx::ui_size_t(uiWidth, uiHeight),
|
||||
Ui::Size(uiWidth, uiHeight),
|
||||
Ui::WindowFlags::stick_to_back,
|
||||
&_events);
|
||||
window->widgets = _widgets;
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenLoco::Ui::Windows::MapToolTip
|
|||
_mapTooltipTimeout++;
|
||||
auto cursor = Input::getMouseLocation();
|
||||
|
||||
static Gfx::point_t tooltipLocation = {};
|
||||
static Ui::Point tooltipLocation = {};
|
||||
if ((std::abs(tooltipLocation.x - cursor.x) > 5)
|
||||
|| (std::abs(tooltipLocation.y - cursor.y) > 5)
|
||||
|| Input::hasFlag(Input::Flags::flag5))
|
||||
|
@ -81,7 +81,7 @@ namespace OpenLoco::Ui::Windows::MapToolTip
|
|||
else
|
||||
{
|
||||
initEvents();
|
||||
window = WindowManager::createWindow(WindowType::mapTooltip, Gfx::point_t(x, y), Gfx::ui_size_t(width, height), WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background, &events);
|
||||
window = WindowManager::createWindow(WindowType::mapTooltip, Ui::Point(x, y), Ui::Size(width, height), WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background, &events);
|
||||
window->widgets = _widgets;
|
||||
auto* skin = ObjectManager::get<InterfaceSkinObject>();
|
||||
window->setColour(WindowColour::secondary, skin->colour_06);
|
||||
|
@ -119,12 +119,12 @@ namespace OpenLoco::Ui::Windows::MapToolTip
|
|||
|
||||
if (_mapTooltipOwner == CompanyId::null || _mapTooltipOwner == CompanyManager::getControllingId())
|
||||
{
|
||||
Gfx::point_t origin(self->x + self->width / 2, self->y + self->height / 2 - 5);
|
||||
Ui::Point origin(self->x + self->width / 2, self->y + self->height / 2 - 5);
|
||||
Gfx::drawStringCentredWrapped(*context, origin, self->width, Colour::black, StringIds::outlined_wcolour2_stringid, &args);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gfx::point_t origin(self->x + self->width / 2 + 13, self->y + self->height / 2 - 5);
|
||||
Ui::Point origin(self->x + self->width / 2 + 13, self->y + self->height / 2 - 5);
|
||||
auto width = Gfx::drawStringCentredWrapped(*context, origin, self->width - 28, Colour::black, StringIds::outlined_wcolour2_stringid, &args);
|
||||
|
||||
auto left = self->width / 2 + self->x + 13 - width / 2 - 28;
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
};
|
||||
static loco_global<uint8_t[256], 0x004FDC5C> _byte_4FDC5C;
|
||||
static loco_global<uint32_t, 0x0526284> _lastMapWindowFlags;
|
||||
static loco_global<Gfx::ui_size_t, 0x00526288> _lastMapWindowSize;
|
||||
static loco_global<Ui::Size, 0x00526288> _lastMapWindowSize;
|
||||
static loco_global<uint16_t, 0x0052628C> _lastMapWindowVar88A;
|
||||
static loco_global<uint16_t, 0x0052628E> _lastMapWindowVar88C;
|
||||
static loco_global<int32_t, 0x00E3F0B8> gCurrentRotation;
|
||||
|
@ -108,7 +108,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
|
||||
static WindowEventList events;
|
||||
|
||||
static Pos2 mapWindowPosToLocation(xy32 pos)
|
||||
static Pos2 mapWindowPosToLocation(Point pos)
|
||||
{
|
||||
pos.x = ((pos.x + 8) - map_columns) / 2;
|
||||
pos.y = ((pos.y + 8)) / 2;
|
||||
|
@ -131,7 +131,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
return { 0, 0 }; // unreachable
|
||||
}
|
||||
|
||||
static xy32 locationToMapWindowPos(Pos2 pos)
|
||||
static Point locationToMapWindowPos(Pos2 pos)
|
||||
{
|
||||
int32_t x = pos.x;
|
||||
int32_t y = pos.y;
|
||||
|
@ -157,13 +157,13 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
x /= tile_size;
|
||||
y /= tile_size;
|
||||
|
||||
return { static_cast<int32_t>(-x + y + map_columns - 8), static_cast<int32_t>(x + y - 8) };
|
||||
return Point(-x + y + map_columns - 8, x + y - 8);
|
||||
}
|
||||
|
||||
// 0x0046B8E6
|
||||
static void onClose(Window* self)
|
||||
{
|
||||
_lastMapWindowSize = Gfx::ui_size_t(self->width, self->height);
|
||||
_lastMapWindowSize = Ui::Size(self->width, self->height);
|
||||
_lastMapWindowVar88A = self->var_88A;
|
||||
_lastMapWindowVar88C = self->var_88C;
|
||||
_lastMapWindowFlags = self->flags | WindowFlags::flag_31;
|
||||
|
@ -208,8 +208,8 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
self->max_width = 800;
|
||||
self->max_height = 800;
|
||||
|
||||
Gfx::ui_size_t minWindowSize = { self->min_width, self->min_height };
|
||||
Gfx::ui_size_t maxWindowSize = { self->max_width, self->max_height };
|
||||
Ui::Size minWindowSize = { self->min_width, self->min_height };
|
||||
Ui::Size maxWindowSize = { self->max_width, self->max_height };
|
||||
self->setSize(minWindowSize, maxWindowSize);
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
}
|
||||
|
||||
// 0x0046C294
|
||||
static std::pair<xy32, xy32> drawRouteLine(Gfx::Context* context, xy32 startPos, xy32 endPos, Pos2 stationPos, uint8_t colour)
|
||||
static std::pair<Point, Point> drawRouteLine(Gfx::Context* context, Point startPos, Point endPos, Pos2 stationPos, uint8_t colour)
|
||||
{
|
||||
auto newStartPos = locationToMapWindowPos({ stationPos.x, stationPos.y });
|
||||
|
||||
|
@ -1075,8 +1075,8 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
if (!colour)
|
||||
return;
|
||||
|
||||
xy32 startPos = { Location::null, 0 };
|
||||
xy32 endPos = { Location::null, 0 };
|
||||
Point startPos = { Location::null, 0 };
|
||||
Point endPos = { Location::null, 0 };
|
||||
for (auto& order : Vehicles::OrderRingView(train.head->orderTableOffset))
|
||||
{
|
||||
if (order.hasFlag(Vehicles::OrderFlags::HasStation))
|
||||
|
@ -1465,7 +1465,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
return;
|
||||
|
||||
_dword_F253A8 = static_cast<uint8_t*>(ptr);
|
||||
Gfx::ui_size_t size = { 350, 272 };
|
||||
Ui::Size size = { 350, 272 };
|
||||
|
||||
if (_lastMapWindowFlags != 0)
|
||||
{
|
||||
|
|
|
@ -65,8 +65,8 @@ namespace OpenLoco::Ui::Windows::MessageWindow
|
|||
|
||||
namespace Messages
|
||||
{
|
||||
static const Gfx::ui_size_t minWindowSize = { 366, 217 };
|
||||
static const Gfx::ui_size_t maxWindowSize = { 366, 1200 };
|
||||
static const Ui::Size minWindowSize = { 366, 217 };
|
||||
static const Ui::Size maxWindowSize = { 366, 1200 };
|
||||
static int8_t messageHeight = 39;
|
||||
|
||||
enum widx
|
||||
|
@ -315,7 +315,7 @@ namespace OpenLoco::Ui::Windows::MessageWindow
|
|||
{
|
||||
int16_t y = 29;
|
||||
int16_t x = Ui::width() - 366;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
window = WindowManager::createWindow(
|
||||
WindowType::messages,
|
||||
|
@ -377,7 +377,7 @@ namespace OpenLoco::Ui::Windows::MessageWindow
|
|||
|
||||
namespace Settings
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 366, 139 };
|
||||
static const Ui::Size windowSize = { 366, 139 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::MusicSelection
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 360, 238 };
|
||||
static const Ui::Size window_size = { 360, 238 };
|
||||
|
||||
static const uint8_t rowHeight = 12; // CJK: 15
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace OpenLoco::Config;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::NewsWindow
|
||||
{
|
||||
static void createNewsWindow(Gfx::ui_size_t windowSize, Widget* widgets, uint8_t colour, bool isOld, uint32_t flags)
|
||||
static void createNewsWindow(Ui::Size windowSize, Widget* widgets, uint8_t colour, bool isOld, uint32_t flags)
|
||||
{
|
||||
_word_525CE0 = 5;
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
}
|
||||
|
||||
int16_t x = (Ui::width() / 2) - (windowSize.width / 2);
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
auto window = WindowManager::createWindow(WindowType::news, origin, windowSize, flags, &News1::events);
|
||||
|
||||
|
@ -128,7 +128,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
_word_525CE0 = 0;
|
||||
int16_t x = Ui::width() - 138;
|
||||
int16_t y = Ui::height() - 25;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
uint32_t flags = WindowFlags::stick_to_front | WindowFlags::viewport_no_scrolling | WindowFlags::transparent | WindowFlags::flag_7;
|
||||
|
||||
auto window = WindowManager::createWindow(WindowType::news, origin, Ticker::windowSize, flags, &Ticker::events);
|
||||
|
|
|
@ -348,11 +348,11 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
{
|
||||
int16_t x = self->widgets[Common::widx::viewport1].left + 1 + self->x;
|
||||
int16_t y = self->widgets[Common::widx::viewport1].top + 1 + self->y;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
uint16_t viewportWidth = self->widgets[Common::widx::viewport1].width();
|
||||
uint16_t viewportHeight = 62;
|
||||
Gfx::ui_size_t viewportSize = { viewportWidth, viewportHeight };
|
||||
Ui::Size viewportSize = { viewportWidth, viewportHeight };
|
||||
|
||||
if (_word_4F8BE4[news->type] & (1 << 1))
|
||||
{
|
||||
|
@ -440,11 +440,11 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
{
|
||||
int16_t x = self->widgets[Common::widx::viewport2].left + 1 + self->x;
|
||||
int16_t y = self->widgets[Common::widx::viewport2].top + 1 + self->y;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
uint16_t viewportWidth = self->widgets[Common::widx::viewport2].width();
|
||||
uint16_t viewportHeight = 62;
|
||||
Gfx::ui_size_t viewportSize = { viewportWidth, viewportHeight };
|
||||
Ui::Size viewportSize = { viewportWidth, viewportHeight };
|
||||
|
||||
if (_word_4F8BE4[news->type] & (1 << 1))
|
||||
{
|
||||
|
@ -586,7 +586,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
|
||||
int16_t x = (self->width / 2) + self->x;
|
||||
int16_t y = self->y + 38;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
Gfx::drawStringCentredWrapped(*context, origin, 352, Colour::black, StringIds::buffer_2039);
|
||||
|
||||
|
@ -666,7 +666,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
|
||||
int16_t x = (self->width / 2) + self->x;
|
||||
int16_t y = self->y + 38;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
Gfx::drawStringCentredWrapped(*context, origin, 352, Colour::black, StringIds::buffer_2039);
|
||||
|
||||
|
@ -709,7 +709,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
|
||||
int16_t x = (self->width / 2) + self->x;
|
||||
int16_t y = self->y + 17;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
Gfx::drawStringCentredWrapped(*context, origin, 338, Colour::black, StringIds::buffer_2039);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
|
||||
namespace News1
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 360, 117 };
|
||||
static const Ui::Size windowSize = { 360, 117 };
|
||||
|
||||
extern Widget widgets[7];
|
||||
|
||||
|
@ -87,14 +87,14 @@ namespace OpenLoco::Ui::Windows::NewsWindow
|
|||
|
||||
namespace News2
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 360, 159 };
|
||||
static const Ui::Size windowSize = { 360, 159 };
|
||||
|
||||
extern Widget widgets[7];
|
||||
}
|
||||
|
||||
namespace Ticker
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 111, 26 };
|
||||
static const Ui::Size windowSize = { 111, 26 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ using namespace OpenLoco::Interop;
|
|||
namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
|
||||
{
|
||||
static constexpr int rowHeight = 12;
|
||||
static Gfx::ui_size_t windowSize = { 600, 398 };
|
||||
static Ui::Size windowSize = { 600, 398 };
|
||||
|
||||
static loco_global<uint8_t[999], 0x004FE384> _4FE384;
|
||||
|
||||
|
@ -300,12 +300,12 @@ namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
|
|||
}
|
||||
}
|
||||
|
||||
static const Gfx::point_t objectPreviewOffset = { 56, 56 };
|
||||
static const Gfx::ui_size_t objectPreviewSize = { 112, 112 };
|
||||
static const Ui::Point objectPreviewOffset = { 56, 56 };
|
||||
static const Ui::Size objectPreviewSize = { 112, 112 };
|
||||
static const uint8_t descriptionRowHeight = 10;
|
||||
|
||||
template<typename T>
|
||||
static void callDrawPreviewImage(Gfx::Context& context, const Gfx::point_t& drawingOffset, void* objectPtr)
|
||||
static void callDrawPreviewImage(Gfx::Context& context, const Ui::Point& drawingOffset, void* objectPtr)
|
||||
{
|
||||
auto object = reinterpret_cast<T*>(objectPtr);
|
||||
object->drawPreviewImage(context, drawingOffset.x, drawingOffset.y);
|
||||
|
@ -318,7 +318,7 @@ namespace OpenLoco::Ui::Windows::ObjectSelectionWindow
|
|||
|
||||
Gfx::Context* clipped = nullptr;
|
||||
// Clip the draw area to simplify image draw
|
||||
Gfx::point_t drawAreaPos = Gfx::point_t{ x, y } - objectPreviewOffset;
|
||||
Ui::Point drawAreaPos = Ui::Point{ x, y } - objectPreviewOffset;
|
||||
if (!Gfx::clipContext(&clipped, context, drawAreaPos, objectPreviewSize))
|
||||
return;
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace OpenLoco::Ui::Windows::Options
|
|||
|
||||
namespace Display
|
||||
{
|
||||
static const Gfx::ui_size_t _window_size = { 400, 250 };
|
||||
static const Ui::Size _window_size = { 400, 250 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -678,7 +678,7 @@ namespace OpenLoco::Ui::Windows::Options
|
|||
|
||||
namespace Sound
|
||||
{
|
||||
static const Gfx::ui_size_t _window_size = { 366, 84 };
|
||||
static const Ui::Size _window_size = { 366, 84 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -863,7 +863,7 @@ namespace OpenLoco::Ui::Windows::Options
|
|||
|
||||
namespace Music
|
||||
{
|
||||
static const Gfx::ui_size_t _window_size = { 366, 129 };
|
||||
static const Ui::Size _window_size = { 366, 129 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -1246,7 +1246,7 @@ namespace OpenLoco::Ui::Windows::Options
|
|||
|
||||
namespace Regional
|
||||
{
|
||||
static const Gfx::ui_size_t _window_size = { 366, 167 };
|
||||
static const Ui::Size _window_size = { 366, 167 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -1746,7 +1746,7 @@ namespace OpenLoco::Ui::Windows::Options
|
|||
|
||||
static constexpr uint64_t enabledWidgets = Common::enabledWidgets | (1 << Controls::Widx::edge_scrolling) | (1 << Controls::Widx::customize_keys) | (1 << Controls::Widx::zoom_to_cursor);
|
||||
|
||||
static const Gfx::ui_size_t _window_size = { 366, 99 };
|
||||
static const Ui::Size _window_size = { 366, 99 };
|
||||
|
||||
static Widget _widgets[] = {
|
||||
common_options_widgets(_window_size, StringIds::options_title_controls),
|
||||
|
@ -1875,7 +1875,7 @@ namespace OpenLoco::Ui::Windows::Options
|
|||
|
||||
namespace Misc
|
||||
{
|
||||
static const Gfx::ui_size_t _window_size = { 420, 174 };
|
||||
static const Ui::Size _window_size = { 420, 174 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -2417,7 +2417,7 @@ namespace OpenLoco::Ui::Windows::Options
|
|||
{
|
||||
Widget* widgets;
|
||||
WindowEventList* events;
|
||||
Gfx::ui_size_t windowSize;
|
||||
Ui::Size windowSize;
|
||||
const uint64_t* enabledWidgets;
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::PlayerInfoPanel
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 140, 27 };
|
||||
static const Ui::Size window_size = { 140, 27 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -179,8 +179,8 @@ namespace OpenLoco::Ui::Windows::PlayerInfoPanel
|
|||
|
||||
auto window = WindowManager::createWindow(
|
||||
WindowType::playerInfoToolbar,
|
||||
Gfx::point_t(0, Ui::height() - window_size.height),
|
||||
Gfx::ui_size_t(window_size.width, window_size.height),
|
||||
Ui::Point(0, Ui::height() - window_size.height),
|
||||
Ui::Size(window_size.width, window_size.height),
|
||||
Ui::WindowFlags::stick_to_front | Ui::WindowFlags::transparent | Ui::WindowFlags::no_background,
|
||||
&_events);
|
||||
window->widgets = _widgets;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace OpenLoco::Ui::Windows::ProgressBar
|
|||
panel,
|
||||
};
|
||||
|
||||
constexpr Gfx::ui_size_t windowSize = { 350, 47 };
|
||||
constexpr Ui::Size windowSize = { 350, 47 };
|
||||
|
||||
Widget widgets[] = {
|
||||
makeWidget({ 0, 0 }, { 350, 47 }, WidgetType::frame, WindowColour::primary),
|
||||
|
@ -99,7 +99,7 @@ namespace OpenLoco::Ui::Windows::ProgressBar
|
|||
self->draw(context);
|
||||
|
||||
Gfx::Context* clipped = nullptr;
|
||||
if (!Gfx::clipContext(&clipped, context, Gfx::point_t(self->x + 2, self->y + 17), Gfx::ui_size_t(self->width - 5, self->height - 19)))
|
||||
if (!Gfx::clipContext(&clipped, context, Ui::Point(self->x + 2, self->y + 17), Ui::Size(self->width - 5, self->height - 19)))
|
||||
return;
|
||||
|
||||
// First, draw the train track.
|
||||
|
|
|
@ -571,7 +571,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
|
|||
// Randomly generated landscape
|
||||
auto imageId = ImageIds::random_map_watermark | (window.getColour(WindowColour::secondary) << 19) | 0x20000000;
|
||||
Gfx::drawImage(&context, x, y, imageId);
|
||||
Gfx::point_t origin = { (int16_t)(x + 64), (int16_t)(y + 60) };
|
||||
Ui::Point origin = { (int16_t)(x + 64), (int16_t)(y + 60) };
|
||||
Gfx::drawStringCentredWrapped(context, origin, 128, 0, StringIds::randomly_generated_landscape);
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
|
|||
static std::string gbuffer;
|
||||
|
||||
// Draw text box text
|
||||
Gfx::point_t origin = { 0, 1 };
|
||||
Ui::Point origin = { 0, 1 };
|
||||
setCommonArgsStringptr(text);
|
||||
Gfx::drawString_494B3F(context, &origin, 0, StringIds::black_stringid, _commonFormatArgs);
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenLoco::Ui::Windows::PromptOkCancel
|
|||
FormatArguments args{};
|
||||
args.push(StringIds::buffer_2039);
|
||||
|
||||
auto origin = Gfx::point_t(self->x + self->width / 2, self->y + 41);
|
||||
auto origin = Ui::Point(self->x + self->width / 2, self->y + 41);
|
||||
Gfx::drawStringCentredWrapped(*context, origin, self->width, Colour::black, StringIds::wcolour2_stringid, &args);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::ScenarioOptions
|
||||
{
|
||||
static const Gfx::ui_size_t challengeWindowSize = { 366, 197 };
|
||||
static const Gfx::ui_size_t companiesWindowSize = { 366, 327 };
|
||||
static const Gfx::ui_size_t otherWindowSize = { 366, 217 };
|
||||
static const Ui::Size challengeWindowSize = { 366, 197 };
|
||||
static const Ui::Size companiesWindowSize = { 366, 327 };
|
||||
static const Ui::Size otherWindowSize = { 366, 217 };
|
||||
|
||||
static loco_global<uint8_t, 0x00525FB7> maxCompetingCompanies;
|
||||
|
||||
|
@ -1216,7 +1216,7 @@ namespace OpenLoco::Ui::Windows::ScenarioOptions
|
|||
|
||||
self->invalidate();
|
||||
|
||||
const Gfx::ui_size_t* newSize;
|
||||
const Ui::Size* newSize;
|
||||
if (widgetIndex == widx::tab_challenge)
|
||||
newSize = &challengeWindowSize;
|
||||
else if (widgetIndex == widx::tab_companies)
|
||||
|
|
|
@ -18,7 +18,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::ScenarioSelect
|
||||
{
|
||||
constexpr Gfx::ui_size_t windowSize = { 610, 412 };
|
||||
constexpr Ui::Size windowSize = { 610, 412 };
|
||||
|
||||
namespace widx
|
||||
{
|
||||
|
@ -103,8 +103,8 @@ namespace OpenLoco::Ui::Windows::ScenarioSelect
|
|||
|
||||
self = WindowManager::createWindow(
|
||||
WindowType::scenarioSelect,
|
||||
Gfx::point_t({ static_cast<int16_t>(width() / 2 - windowSize.width / 2),
|
||||
std::max<int16_t>(height() / 2 - windowSize.height / 2, 28) }),
|
||||
Ui::Point({ static_cast<int16_t>(width() / 2 - windowSize.width / 2),
|
||||
std::max<int16_t>(height() / 2 - windowSize.height / 2, 28) }),
|
||||
windowSize,
|
||||
WindowFlags::stick_to_front | WindowFlags::flag_12,
|
||||
&_events);
|
||||
|
@ -174,7 +174,7 @@ namespace OpenLoco::Ui::Windows::ScenarioSelect
|
|||
continue;
|
||||
|
||||
const auto offset = self->current_tab == i ? 1 : 0;
|
||||
auto origin = Gfx::point_t(widget.mid_x() + self->x, widget.mid_y() + self->y - 3 - offset);
|
||||
auto origin = Ui::Point(widget.mid_x() + self->x, widget.mid_y() + self->y - 3 - offset);
|
||||
const string_id caption = scenarioGroupIds[i];
|
||||
|
||||
Gfx::drawStringCentredWrapped(*context, origin, widget.width() - 4, Colour::black, StringIds::wcolour2_stringid, &caption);
|
||||
|
@ -271,7 +271,7 @@ namespace OpenLoco::Ui::Windows::ScenarioSelect
|
|||
args.push(StringIds::randomly_generated_landscape);
|
||||
|
||||
// Overlay random map note.
|
||||
auto origin = Gfx::point_t(x, y);
|
||||
auto origin = Ui::Point(x, y);
|
||||
Gfx::drawStringCentredWrapped(*context, origin, 128, Colour::black, StringIds::wcolour2_stringid, &args);
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ namespace OpenLoco::Ui::Windows::ScenarioSelect
|
|||
|
||||
// Challenge header
|
||||
y += 5;
|
||||
auto origin = Gfx::point_t(x, y);
|
||||
auto origin = Ui::Point(x, y);
|
||||
Gfx::drawString_494B3F(*context, &origin, Colour::black, StringIds::challenge_label, nullptr);
|
||||
|
||||
// Challenge text
|
||||
|
|
|
@ -21,9 +21,9 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::StationList
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 600, 197 };
|
||||
static const Gfx::ui_size_t max_dimensions = { 640, 1200 };
|
||||
static const Gfx::ui_size_t min_dimensions = { 192, 100 };
|
||||
static const Ui::Size window_size = { 600, 197 };
|
||||
static const Ui::Size max_dimensions = { 640, 1200 };
|
||||
static const Ui::Size min_dimensions = { 192, 100 };
|
||||
|
||||
static const uint8_t rowHeight = 10; // CJK: 13
|
||||
|
||||
|
@ -569,7 +569,7 @@ namespace OpenLoco::Ui::Windows::StationList
|
|||
_common_format_args[1] = window->var_83C;
|
||||
|
||||
// Draw number of stations.
|
||||
auto origin = Gfx::point_t(window->x + 4, window->y + window->height - 12);
|
||||
auto origin = Ui::Point(window->x + 4, window->y + window->height - 12);
|
||||
Gfx::drawString_494B3F(*context, &origin, Colour::black, StringIds::black_stringid, &*_common_format_args);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ namespace OpenLoco::Ui::Windows::Station
|
|||
|
||||
namespace Common
|
||||
{
|
||||
static const Gfx::ui_size_t minWindowSize = { 192, 136 };
|
||||
static const Ui::Size minWindowSize = { 192, 136 };
|
||||
|
||||
static const Gfx::ui_size_t maxWindowSize = { 600, 440 };
|
||||
static const Ui::Size maxWindowSize = { 600, 440 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ namespace OpenLoco::Ui::Windows::Station
|
|||
|
||||
namespace Station
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 223, 136 };
|
||||
static const Ui::Size windowSize = { 223, 136 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -234,8 +234,8 @@ namespace OpenLoco::Ui::Windows::Station
|
|||
{
|
||||
auto widget = &self->widgets[widx::viewport];
|
||||
auto tile = Map::Pos3({ station->x, station->y, station->z });
|
||||
auto origin = Gfx::point_t(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Gfx::ui_size_t(widget->width() - 2, widget->height() - 2);
|
||||
auto origin = Ui::Point(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Ui::Size(widget->width() - 2, widget->height() - 2);
|
||||
ViewportManager::create(self, 0, origin, size, self->saved_view.zoomLevel, tile);
|
||||
self->invalidate();
|
||||
self->flags |= WindowFlags::viewport_no_scrolling;
|
||||
|
@ -562,9 +562,9 @@ namespace OpenLoco::Ui::Windows::Station
|
|||
|
||||
namespace CargoRatings
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 249, 136 };
|
||||
static const Ui::Size windowSize = { 249, 136 };
|
||||
|
||||
static const Gfx::ui_size_t maxWindowSize = { 249, 440 };
|
||||
static const Ui::Size maxWindowSize = { 249, 440 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
|
||||
namespace PlantTrees
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 634, 162 };
|
||||
static const Ui::Size windowSize = { 634, 162 };
|
||||
|
||||
static const uint8_t rowHeight = 102;
|
||||
static const uint8_t columnWidth = 66;
|
||||
|
@ -296,8 +296,8 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
static void onResize(Window* self)
|
||||
{
|
||||
self->invalidate();
|
||||
Gfx::ui_size_t minWindowSize = { self->min_width, self->min_height };
|
||||
Gfx::ui_size_t maxWindowSize = { self->max_width, self->max_height };
|
||||
Ui::Size minWindowSize = { self->min_width, self->min_height };
|
||||
Ui::Size maxWindowSize = { self->max_width, self->max_height };
|
||||
bool hasResized = self->setSize(minWindowSize, maxWindowSize);
|
||||
if (hasResized)
|
||||
updateActiveThumb(self);
|
||||
|
@ -969,7 +969,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
else
|
||||
{
|
||||
// 0x004BB586
|
||||
auto origin = Gfx::point_t(Ui::width() - PlantTrees::windowSize.width, 30);
|
||||
auto origin = Ui::Point(Ui::width() - PlantTrees::windowSize.width, 30);
|
||||
|
||||
window = WindowManager::createWindow(
|
||||
WindowType::terraform,
|
||||
|
@ -1923,7 +1923,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
|
||||
namespace BuildWalls
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 418, 108 };
|
||||
static const Ui::Size windowSize = { 418, 108 };
|
||||
|
||||
static const uint8_t rowHeight = 48;
|
||||
|
||||
|
@ -2027,8 +2027,8 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
static void onResize(Window* self)
|
||||
{
|
||||
self->invalidate();
|
||||
Gfx::ui_size_t minWindowSize = { self->min_width, self->min_height };
|
||||
Gfx::ui_size_t maxWindowSize = { self->max_width, self->max_height };
|
||||
Ui::Size minWindowSize = { self->min_width, self->min_height };
|
||||
Ui::Size maxWindowSize = { self->max_width, self->max_height };
|
||||
bool hasResized = self->setSize(minWindowSize, maxWindowSize);
|
||||
if (hasResized)
|
||||
updateActiveThumb(self);
|
||||
|
@ -2417,7 +2417,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
|
||||
// CHANGE: width set to 161 to include building walls tab
|
||||
uint16_t width = 161;
|
||||
Gfx::ui_size_t windowSize = { width, height };
|
||||
Ui::Size windowSize = { width, height };
|
||||
self->setSize(windowSize, windowSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace OpenLoco::Ui::Windows::TextInput
|
|||
*((string_id*)(&_commonFormatArgs[0])) = _message;
|
||||
memcpy(&_commonFormatArgs[2], _formatArgs + 8, 8);
|
||||
|
||||
Gfx::point_t position = { (int16_t)(window->x + window->width / 2), (int16_t)(window->y + 30) };
|
||||
Ui::Point position = { (int16_t)(window->x + window->width / 2), (int16_t)(window->y + 30) };
|
||||
Gfx::drawStringCentredWrapped(*context, position, window->width - 8, 0, StringIds::wcolour2_stringid, &_commonFormatArgs[0]);
|
||||
|
||||
auto widget = &_widgets[Widx::input];
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace OpenLoco::Ui::Windows::TileInspector
|
|||
{
|
||||
static TilePos2 _currentPosition{};
|
||||
|
||||
constexpr Gfx::ui_size_t windowSize = { 250, 182 };
|
||||
constexpr Ui::Size windowSize = { 250, 182 };
|
||||
|
||||
namespace widx
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::TimePanel
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 140, 27 };
|
||||
static const Ui::Size window_size = { 140, 27 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -91,8 +91,8 @@ namespace OpenLoco::Ui::Windows::TimePanel
|
|||
|
||||
auto window = WindowManager::createWindow(
|
||||
WindowType::timeToolbar,
|
||||
Gfx::point_t(Ui::width() - window_size.width, Ui::height() - window_size.height),
|
||||
Gfx::ui_size_t(window_size.width, window_size.height),
|
||||
Ui::Point(Ui::width() - window_size.width, Ui::height() - window_size.height),
|
||||
Ui::Size(window_size.width, window_size.height),
|
||||
Ui::WindowFlags::stick_to_front | Ui::WindowFlags::transparent | Ui::WindowFlags::no_background,
|
||||
&_events);
|
||||
window->widgets = _widgets;
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::TitleExit
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 40, 28 };
|
||||
static const Ui::Size window_size = { 40, 28 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace OpenLoco::Ui::Windows::TitleExit
|
|||
|
||||
auto window = OpenLoco::Ui::WindowManager::createWindow(
|
||||
WindowType::titleExit,
|
||||
Gfx::point_t(Ui::width() - window_size.width, Ui::height() - window_size.height),
|
||||
Ui::Point(Ui::width() - window_size.width, Ui::height() - window_size.height),
|
||||
window_size,
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background | WindowFlags::flag_6,
|
||||
&_events);
|
||||
|
@ -74,7 +74,7 @@ namespace OpenLoco::Ui::Windows::TitleExit
|
|||
|
||||
int16_t x = window->x + window->width / 2;
|
||||
int16_t y = window->y + window->widgets[Widx::exit_button].top + 8;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
Gfx::drawStringCentredWrapped(*context, origin, window->width, Colour::black, StringIds::title_exit_game);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::TitleLogo
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 298, 170 };
|
||||
static const Ui::Size window_size = { 298, 170 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace OpenLoco::Ui::Windows::TitleMenu
|
|||
|
||||
auto window = OpenLoco::Ui::WindowManager::createWindow(
|
||||
WindowType::titleMenu,
|
||||
Gfx::point_t((Ui::width() - ww) / 2, Ui::height() - wh - 25),
|
||||
Ui::Point((Ui::width() - ww) / 2, Ui::height() - wh - 25),
|
||||
{ ww, wh },
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background | WindowFlags::flag_6,
|
||||
&_events);
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::TitleOptions
|
||||
{
|
||||
static const Gfx::ui_size_t window_size = { 60, 15 };
|
||||
static const Ui::Size window_size = { 60, 15 };
|
||||
|
||||
namespace Widx
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace OpenLoco::Ui::Windows::TitleOptions
|
|||
|
||||
auto window = WindowManager::createWindow(
|
||||
WindowType::titleOptions,
|
||||
Gfx::point_t(Ui::width() - window_size.width, 0),
|
||||
Ui::Point(Ui::width() - window_size.width, 0),
|
||||
window_size,
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background | WindowFlags::flag_6,
|
||||
&_events);
|
||||
|
@ -63,7 +63,7 @@ namespace OpenLoco::Ui::Windows::TitleOptions
|
|||
|
||||
int16_t x = window->x + window->width / 2;
|
||||
int16_t y = window->y + window->widgets[Widx::options_button].top + 2;
|
||||
Gfx::point_t origin = { x, y };
|
||||
Ui::Point origin = { x, y };
|
||||
|
||||
Gfx::drawStringCentredWrapped(*context, origin, window->width, Colour::white, StringIds::outlined_wcolour2_stringid, (const char*)&StringIds::options);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ namespace OpenLoco::Ui::Windows::TitleVersion
|
|||
auto height = 16;
|
||||
auto window = OpenLoco::Ui::WindowManager::createWindow(
|
||||
WindowType::openLocoVersion,
|
||||
Gfx::point_t(8, Ui::height() - height),
|
||||
Gfx::ui_size_t(width, height),
|
||||
Ui::Point(8, Ui::height() - height),
|
||||
Ui::Size(width, height),
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background | WindowFlags::flag_6,
|
||||
&_events);
|
||||
window->widgets = widgets;
|
||||
|
|
|
@ -96,8 +96,8 @@ namespace OpenLoco::Ui::Windows::ToolTip
|
|||
|
||||
auto tooltip = WindowManager::createWindow(
|
||||
WindowType::tooltip,
|
||||
Gfx::point_t(x, y),
|
||||
Gfx::ui_size_t(width, height),
|
||||
Ui::Point(x, y),
|
||||
Ui::Size(width, height),
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::flag_7,
|
||||
&events);
|
||||
tooltip->widgets = _widgets;
|
||||
|
|
|
@ -128,8 +128,8 @@ namespace OpenLoco::Ui::Windows::ToolbarBottom::Editor
|
|||
{
|
||||
initEvents();
|
||||
|
||||
Gfx::point_t origin = Gfx::point_t(0, Ui::height() - windowHeight);
|
||||
Gfx::ui_size_t windowSize = Gfx::ui_size_t(Ui::width(), windowHeight);
|
||||
Ui::Point origin = Ui::Point(0, Ui::height() - windowHeight);
|
||||
Ui::Size windowSize = Ui::Size(Ui::width(), windowHeight);
|
||||
auto window = WindowManager::createWindow(
|
||||
WindowType::editorToolbar,
|
||||
origin,
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace OpenLoco::Ui::Windows::ToolbarTop::Game
|
|||
auto window = WindowManager::createWindow(
|
||||
WindowType::topToolbar,
|
||||
{ 0, 0 },
|
||||
Gfx::ui_size_t(Ui::width(), 28),
|
||||
Ui::Size(Ui::width(), 28),
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background,
|
||||
&_events);
|
||||
window->widgets = _widgets;
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace OpenLoco::Ui::Windows::ToolbarTop::Editor
|
|||
auto window = WindowManager::createWindow(
|
||||
WindowType::topToolbar,
|
||||
{ 0, 0 },
|
||||
Gfx::ui_size_t(Ui::width(), 28),
|
||||
Ui::Size(Ui::width(), 28),
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background,
|
||||
&_events);
|
||||
window->widgets = _widgets;
|
||||
|
|
|
@ -75,9 +75,9 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
|
||||
namespace TownList
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 600, 197 };
|
||||
static const Gfx::ui_size_t maxDimensions = { 600, 900 };
|
||||
static const Gfx::ui_size_t minDimensions = { 192, 100 };
|
||||
static const Ui::Size windowSize = { 600, 197 };
|
||||
static const Ui::Size maxDimensions = { 600, 900 };
|
||||
static const Ui::Size minDimensions = { 192, 100 };
|
||||
|
||||
static const uint8_t rowHeight = 10;
|
||||
|
||||
|
@ -522,7 +522,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
else
|
||||
{
|
||||
// 0x00499CFC
|
||||
auto origin = Gfx::point_t(Ui::width() - TownList::windowSize.width, 30);
|
||||
auto origin = Ui::Point(Ui::width() - TownList::windowSize.width, 30);
|
||||
|
||||
window = WindowManager::createWindow(
|
||||
WindowType::townList,
|
||||
|
@ -591,7 +591,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
|
||||
namespace BuildTowns
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 220, 87 };
|
||||
static const Ui::Size windowSize = { 220, 87 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -791,7 +791,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
|
||||
namespace BuildBuildings
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 600, 172 };
|
||||
static const Ui::Size windowSize = { 600, 172 };
|
||||
|
||||
static const uint8_t rowHeight = 112;
|
||||
|
||||
|
@ -1157,8 +1157,8 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
static void onResize(Window* self)
|
||||
{
|
||||
self->invalidate();
|
||||
Gfx::ui_size_t minWindowSize = { self->min_width, self->min_height };
|
||||
Gfx::ui_size_t maxWindowSize = { self->max_width, self->max_height };
|
||||
Ui::Size minWindowSize = { self->min_width, self->min_height };
|
||||
Ui::Size maxWindowSize = { self->max_width, self->max_height };
|
||||
bool hasResized = self->setSize(minWindowSize, maxWindowSize);
|
||||
if (hasResized)
|
||||
updateActiveThumb(self);
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace OpenLoco::GameCommands;
|
|||
|
||||
namespace OpenLoco::Ui::Windows::Town
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 223, 161 };
|
||||
static const Ui::Size windowSize = { 223, 161 };
|
||||
|
||||
static loco_global<uint16_t[10], 0x0112C826> commonFormatArgs;
|
||||
|
||||
|
@ -232,7 +232,7 @@ namespace OpenLoco::Ui::Windows::Town
|
|||
{
|
||||
// Call to sub_498E9B has been deliberately omitted.
|
||||
|
||||
self->setSize(Gfx::ui_size_t(192, 161), Gfx::ui_size_t(600, 440));
|
||||
self->setSize(Ui::Size(192, 161), Ui::Size(600, 440));
|
||||
|
||||
if (self->viewports[0] != nullptr)
|
||||
{
|
||||
|
@ -300,8 +300,8 @@ namespace OpenLoco::Ui::Windows::Town
|
|||
{
|
||||
auto widget = &self->widgets[widx::viewport];
|
||||
auto tile = Map::Pos3({ town->x, town->y, tileZ });
|
||||
auto origin = Gfx::point_t(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Gfx::ui_size_t(widget->width() - 2, widget->height() - 2);
|
||||
auto origin = Ui::Point(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Ui::Size(widget->width() - 2, widget->height() - 2);
|
||||
ViewportManager::create(self, 0, origin, size, self->saved_view.zoomLevel, tile);
|
||||
self->invalidate();
|
||||
self->flags |= WindowFlags::viewport_no_scrolling;
|
||||
|
@ -491,7 +491,7 @@ namespace OpenLoco::Ui::Windows::Town
|
|||
{
|
||||
// Call to sub_498E9B has been deliberately omitted.
|
||||
|
||||
self->setSize(Gfx::ui_size_t(299, 172), Gfx::ui_size_t(299, 327));
|
||||
self->setSize(Ui::Size(299, 172), Ui::Size(299, 327));
|
||||
}
|
||||
|
||||
static void initEvents()
|
||||
|
@ -589,7 +589,7 @@ namespace OpenLoco::Ui::Windows::Town
|
|||
{
|
||||
// Call to sub_498E9B has been deliberately omitted.
|
||||
|
||||
self->setSize(Gfx::ui_size_t(340, 208), Gfx::ui_size_t(340, 208));
|
||||
self->setSize(Ui::Size(340, 208), Ui::Size(340, 208));
|
||||
}
|
||||
|
||||
static void initEvents()
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace OpenLoco::Ui::Windows::Tutorial
|
|||
frame,
|
||||
};
|
||||
|
||||
constexpr Gfx::ui_size_t windowSize = { 140, 29 };
|
||||
constexpr Ui::Size windowSize = { 140, 29 };
|
||||
|
||||
Widget widgets[] = {
|
||||
makeWidget({ 0, 0 }, windowSize, WidgetType::wt_3, WindowColour::primary),
|
||||
|
@ -35,8 +35,8 @@ namespace OpenLoco::Ui::Windows::Tutorial
|
|||
|
||||
auto window = WindowManager::createWindow(
|
||||
WindowType::tutorial,
|
||||
Gfx::point_t(windowSize.width, Ui::height() - 27),
|
||||
Gfx::ui_size_t(Ui::width() - 280, 27),
|
||||
Ui::Point(windowSize.width, Ui::height() - 27),
|
||||
Ui::Size(Ui::width() - 280, 27),
|
||||
WindowFlags::stick_to_front | WindowFlags::transparent | WindowFlags::no_background,
|
||||
&_events);
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
|
||||
namespace Details
|
||||
{
|
||||
static const Gfx::ui_size_t minWindowSize = { 192, 148 };
|
||||
static const Gfx::ui_size_t maxWindowSize = { 400, 440 };
|
||||
static const Ui::Size minWindowSize = { 192, 148 };
|
||||
static const Ui::Size maxWindowSize = { 400, 440 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -119,8 +119,8 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
|
||||
namespace Cargo
|
||||
{
|
||||
static const Gfx::ui_size_t minWindowSize = { 192, 142 };
|
||||
static const Gfx::ui_size_t maxWindowSize = { 400, 440 };
|
||||
static const Ui::Size minWindowSize = { 192, 142 };
|
||||
static const Ui::Size maxWindowSize = { 400, 440 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -143,8 +143,8 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
|
||||
namespace Finances
|
||||
{
|
||||
static const Gfx::ui_size_t minWindowSize = { 400, 202 };
|
||||
static const Gfx::ui_size_t maxWindowSize = minWindowSize;
|
||||
static const Ui::Size minWindowSize = { 400, 202 };
|
||||
static const Ui::Size maxWindowSize = minWindowSize;
|
||||
|
||||
static WindowEventList events;
|
||||
constexpr uint64_t enabledWidgets = Common::enabledWidgets;
|
||||
|
@ -159,8 +159,8 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
|
||||
namespace Route
|
||||
{
|
||||
static const Gfx::ui_size_t minWindowSize = { 265, 178 };
|
||||
static const Gfx::ui_size_t maxWindowSize = { 600, 440 };
|
||||
static const Ui::Size minWindowSize = { 265, 178 };
|
||||
static const Ui::Size maxWindowSize = { 600, 440 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -210,9 +210,9 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
|
||||
namespace Main
|
||||
{
|
||||
static const Gfx::ui_size_t windowSize = { 265, 177 };
|
||||
static const Gfx::ui_size_t minWindowSize = { 192, 177 };
|
||||
static const Gfx::ui_size_t maxWindowSize = { 600, 440 };
|
||||
static const Ui::Size windowSize = { 265, 177 };
|
||||
static const Ui::Size minWindowSize = { 192, 177 };
|
||||
static const Ui::Size maxWindowSize = { 600, 440 };
|
||||
|
||||
enum widx
|
||||
{
|
||||
|
@ -317,8 +317,8 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
if (self->viewports[0] == nullptr)
|
||||
{
|
||||
auto widget = &self->widgets[widx::viewport];
|
||||
auto origin = Gfx::point_t(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Gfx::ui_size_t(widget->width() - 2, widget->height() - 2);
|
||||
auto origin = Ui::Point(widget->left + self->x + 1, widget->top + self->y + 1);
|
||||
auto size = Ui::Size(widget->width() - 2, widget->height() - 2);
|
||||
ViewportManager::create(self, 0, origin, size, self->saved_view.zoomLevel, targetThing);
|
||||
self->invalidate();
|
||||
self->flags |= WindowFlags::viewport_no_scrolling;
|
||||
|
@ -937,7 +937,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
{
|
||||
FormatArguments args = {};
|
||||
args.push(StringIds::getVehicleType(veh->vehicleType));
|
||||
Gfx::point_t origin;
|
||||
Ui::Point origin;
|
||||
Widget& button = self->widgets[widx::viewport];
|
||||
origin.x = self->x + button.mid_x();
|
||||
origin.y = self->y + button.mid_y();
|
||||
|
@ -1407,7 +1407,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
|
||||
auto head = Common::getVehicle(self);
|
||||
OpenLoco::Vehicles::Vehicle train{ head };
|
||||
Gfx::point_t pos = { static_cast<int16_t>(self->x + 3), static_cast<int16_t>(self->y + self->height - 23) };
|
||||
Ui::Point pos = { static_cast<int16_t>(self->x + 3), static_cast<int16_t>(self->y + self->height - 23) };
|
||||
|
||||
{
|
||||
FormatArguments args{};
|
||||
|
@ -1442,7 +1442,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
Gfx::clearSingle(context, Colour::getShade(self.getColour(WindowColour::secondary), 4));
|
||||
auto head = Common::getVehicle(&self);
|
||||
OpenLoco::Vehicles::Vehicle train{ head };
|
||||
Gfx::point_t pos{ 0, 0 };
|
||||
Ui::Point pos{ 0, 0 };
|
||||
for (auto& car : train.cars)
|
||||
{
|
||||
string_id carStr = StringIds::black_stringid;
|
||||
|
@ -1510,7 +1510,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
events.draw_scroll = drawScroll;
|
||||
}
|
||||
|
||||
static Ui::Window* getVehicleDetailsWindow(const Gfx::point_t& pos)
|
||||
static Ui::Window* getVehicleDetailsWindow(const Ui::Point& pos)
|
||||
{
|
||||
auto vehicleWindow = WindowManager::findAt(pos);
|
||||
if (vehicleWindow == nullptr || vehicleWindow->type != WindowType::vehicle || vehicleWindow->current_tab != (Common::widx::tabDetails - Common::widx::tabMain))
|
||||
|
@ -1520,7 +1520,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
return vehicleWindow;
|
||||
}
|
||||
|
||||
static Vehicles::VehicleBase* getCarFromScrollViewPos(Ui::Window& self, const Gfx::point_t& pos)
|
||||
static Vehicles::VehicleBase* getCarFromScrollViewPos(Ui::Window& self, const Ui::Point& pos)
|
||||
{
|
||||
int16_t scrollX;
|
||||
int16_t scrollY;
|
||||
|
@ -1544,7 +1544,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
return car->front;
|
||||
}
|
||||
|
||||
void scrollDrag(const Gfx::point_t& pos)
|
||||
void scrollDrag(const Ui::Point& pos)
|
||||
{
|
||||
auto vehicleWindow = getVehicleDetailsWindow(pos);
|
||||
if (vehicleWindow == nullptr)
|
||||
|
@ -1596,7 +1596,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
}
|
||||
}
|
||||
|
||||
void scrollDragEnd(const Gfx::point_t& pos)
|
||||
void scrollDragEnd(const Ui::Point& pos)
|
||||
{
|
||||
auto vehicleWindow = getVehicleDetailsWindow(pos);
|
||||
if (vehicleWindow == nullptr && _dragCarComponent != nullptr)
|
||||
|
@ -2044,7 +2044,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
self->draw(context);
|
||||
Common::drawTabs(self, context);
|
||||
|
||||
auto pos = Gfx::point_t(self->x + 4, self->y + 46);
|
||||
auto pos = Ui::Point(self->x + 4, self->y + 46);
|
||||
|
||||
auto head = Common::getVehicle(self);
|
||||
Vehicles::Vehicle train(head);
|
||||
|
@ -2981,7 +2981,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
if (Input::isToolActive(WindowType::vehicle, self->number))
|
||||
{
|
||||
// Location at bottom left edge of window
|
||||
Gfx::point_t loc{ static_cast<int16_t>(self->x + 3), static_cast<int16_t>(self->y + self->height - 13) };
|
||||
Ui::Point loc{ static_cast<int16_t>(self->x + 3), static_cast<int16_t>(self->y + self->height - 13) };
|
||||
|
||||
Gfx::drawString_494BBF(*context, loc.x, loc.y, self->width - 14, Colour::black, StringIds::route_click_on_waypoint);
|
||||
}
|
||||
|
@ -3069,7 +3069,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
// 0x004B4A58 based on
|
||||
static void sub_4B4A58(Window& self, Gfx::Context& context, const string_id strFormat, FormatArguments& args, Vehicles::Order& order, int16_t& y)
|
||||
{
|
||||
Gfx::point_t loc = { 8, static_cast<int16_t>(y - 1) };
|
||||
Ui::Point loc = { 8, static_cast<int16_t>(y - 1) };
|
||||
Gfx::drawString_494B3F(context, &loc, Colour::black, strFormat, &args);
|
||||
if (order.hasFlag(Vehicles::OrderFlags::HasNumber))
|
||||
{
|
||||
|
@ -3148,7 +3148,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
}
|
||||
|
||||
// Output the end of orders
|
||||
Gfx::point_t loc = { 8, static_cast<int16_t>(rowNum * lineHeight) };
|
||||
Ui::Point loc = { 8, static_cast<int16_t>(rowNum * lineHeight) };
|
||||
auto strFormat = StringIds::black_stringid;
|
||||
if (self.var_842 == rowNum)
|
||||
{
|
||||
|
@ -3538,7 +3538,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
|
||||
auto viewPos = Map::gameToScreen(*nodeLoc, res.second->getRotation());
|
||||
auto uiPos = res.second->mapToUi(viewPos);
|
||||
auto distance = Math::Vector::manhattanDistance(uiPos, xy32{ x, y });
|
||||
auto distance = Math::Vector::manhattanDistance(uiPos, Point{ x, y });
|
||||
if (distance < bestDistance)
|
||||
{
|
||||
bestDistance = distance;
|
||||
|
@ -3590,7 +3590,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
}
|
||||
|
||||
// 0x004A43E4
|
||||
static uint16_t getRoadProgressAtCursor(const xy32& cursorLoc, Ui::Viewport& viewport, const RoadElement& roadElement, const Map::Pos3& loc)
|
||||
static uint16_t getRoadProgressAtCursor(const Point& cursorLoc, Ui::Viewport& viewport, const RoadElement& roadElement, const Map::Pos3& loc)
|
||||
{
|
||||
// Get the coordinates of the first tile of the possibly multitile road
|
||||
const auto& roadDataArr = Map::TrackData::getRoadPiece(roadElement.roadId());
|
||||
|
@ -3707,7 +3707,7 @@ namespace OpenLoco::Ui::Windows::Vehicle
|
|||
}
|
||||
|
||||
// 0x004A43E4
|
||||
static uint16_t getTrackProgressAtCursor(const xy32& cursorLoc, Ui::Viewport& viewport, const TrackElement& trackElement, const Map::Pos3& loc)
|
||||
static uint16_t getTrackProgressAtCursor(const Point& cursorLoc, Ui::Viewport& viewport, const TrackElement& trackElement, const Map::Pos3& loc)
|
||||
{
|
||||
// Get the coordinates of the first tile of the possibly multitile track
|
||||
const auto& trackDataArr = Map::TrackData::getTrackPiece(trackElement.trackId());
|
||||
|
|
|
@ -27,9 +27,9 @@ namespace OpenLoco::Ui::Windows::VehicleList
|
|||
{
|
||||
static loco_global<VehicleType, 0x00525FAF> _lastVehiclesOption;
|
||||
|
||||
static const Gfx::ui_size_t window_size = { 550, 213 };
|
||||
static const Gfx::ui_size_t max_dimensions = { 550, 1200 };
|
||||
static const Gfx::ui_size_t min_dimensions = { 220, 160 };
|
||||
static const Ui::Size window_size = { 550, 213 };
|
||||
static const Ui::Size max_dimensions = { 550, 1200 };
|
||||
static const Ui::Size min_dimensions = { 220, 160 };
|
||||
|
||||
static WindowEventList _events;
|
||||
|
||||
|
|
|
@ -242,7 +242,6 @@
|
|||
<ClInclude Include="Graphics\Colour.h" />
|
||||
<ClInclude Include="Graphics\Gfx.h" />
|
||||
<ClInclude Include="Graphics\ImageIds.h" />
|
||||
<ClInclude Include="Graphics\Types.h" />
|
||||
<ClInclude Include="Gui.h" />
|
||||
<ClInclude Include="Industry.h" />
|
||||
<ClInclude Include="IndustryManager.h" />
|
||||
|
@ -334,6 +333,7 @@
|
|||
<ClInclude Include="Ui\Screenshot.h" />
|
||||
<ClInclude Include="Ui\ScrollView.h" />
|
||||
<ClInclude Include="Ui\TextInput.h" />
|
||||
<ClInclude Include="Ui\Types.hpp" />
|
||||
<ClInclude Include="Ui\WindowManager.h" />
|
||||
<ClInclude Include="Ui\WindowType.h" />
|
||||
<ClInclude Include="Utility\Collection.hpp" />
|
||||
|
|
Loading…
Reference in New Issue