mirror of https://github.com/OpenRCT2/OpenRCT2.git
Compare commits
5 Commits
c08143b640
...
b9d5798fe9
Author | SHA1 | Date |
---|---|---|
Michael Steenbeek | b9d5798fe9 | |
Harry Hopkinson | 9266a6f0d3 | |
Gymnasiast | e625a9f97d | |
Gymnasiast | eec4d5eb97 | |
Gymnasiast | 2340d7fe0b |
|
@ -3698,6 +3698,8 @@ STR_6623 :Type ‘help’ for a list of available commands. Type ‘hide’ t
|
|||
STR_6624 :Tile Inspector: Sort elements
|
||||
STR_6625 :Invalid colour
|
||||
STR_6626 :Animation is backwards
|
||||
STR_6627 :Touch mode
|
||||
STR_6628 :Modifies the interface to be more suitable for touch usage
|
||||
|
||||
#############
|
||||
# Scenarios #
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "openrct2/config/Config.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <iterator>
|
||||
|
@ -28,6 +30,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
constexpr int32_t DROPDOWN_TEXT_MAX_ROWS = 32;
|
||||
|
||||
constexpr int32_t DROPDOWN_ITEM_HEIGHT = 12;
|
||||
constexpr int32_t DROPDOWN_ITEM_HEIGHT_TOUCH = 24;
|
||||
|
||||
static constexpr std::array<uint8_t, 57> _appropriateImageDropdownItemsPerRow = {
|
||||
1, 1, 1, 1, 2, 2, 3, 3, 4, 3, // 10
|
||||
|
@ -87,6 +90,16 @@ namespace OpenRCT2::Ui::Windows
|
|||
InputSetState(InputState::DropdownActive);
|
||||
}
|
||||
|
||||
static int32_t GetDefaultRowHeight()
|
||||
{
|
||||
return gConfigInterface.TouchMode ? DROPDOWN_ITEM_HEIGHT_TOUCH : DROPDOWN_ITEM_HEIGHT;
|
||||
}
|
||||
|
||||
static int32_t GetAdditionalRowPadding()
|
||||
{
|
||||
return gConfigInterface.TouchMode ? 6 : 0;
|
||||
}
|
||||
|
||||
void OnDraw(DrawPixelInfo& dpi) override
|
||||
{
|
||||
DrawWidgets(dpi);
|
||||
|
@ -155,8 +168,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
colour = NOT_TRANSLUCENT(colours[0]) | COLOUR_FLAG_INSET;
|
||||
|
||||
// Draw item string
|
||||
auto yOffset = GetAdditionalRowPadding();
|
||||
Formatter ft(reinterpret_cast<uint8_t*>(&gDropdownItems[i].Args));
|
||||
DrawTextEllipsised(dpi, screenCoords, width - 5, item, ft, { colour });
|
||||
DrawTextEllipsised(dpi, { screenCoords.x, screenCoords.y + yOffset }, width - 5, item, ft, { colour });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +182,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
// Set and calculate num items, rows and columns
|
||||
ItemWidth = itemWidth;
|
||||
ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customHeight : DROPDOWN_ITEM_HEIGHT;
|
||||
ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customHeight : GetDefaultRowHeight();
|
||||
gDropdownNumItems = static_cast<int32_t>(numItems);
|
||||
// There must always be at least one column to prevent dividing by zero
|
||||
if (gDropdownNumItems == 0)
|
||||
|
@ -331,7 +345,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t width)
|
||||
{
|
||||
InputSetFlag(static_cast<INPUT_FLAGS>(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false);
|
||||
if (flags & Dropdown::Flag::StayOpen)
|
||||
if (flags & Dropdown::Flag::StayOpen || gConfigInterface.TouchMode)
|
||||
InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true);
|
||||
|
||||
WindowDropdownClose();
|
||||
|
@ -363,7 +377,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t itemHeight, int32_t numColumns)
|
||||
{
|
||||
InputSetFlag(static_cast<INPUT_FLAGS>(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false);
|
||||
if (flags & Dropdown::Flag::StayOpen)
|
||||
if (flags & Dropdown::Flag::StayOpen || gConfigInterface.TouchMode)
|
||||
InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true);
|
||||
|
||||
// Close existing dropdown
|
||||
|
@ -494,9 +508,10 @@ static constexpr colour_t kColoursDropdownOrder[] = {
|
|||
}
|
||||
|
||||
// Show dropdown
|
||||
auto squareSize = DropdownWindow::GetDefaultRowHeight();
|
||||
WindowDropdownShowImage(
|
||||
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour,
|
||||
Dropdown::Flag::StayOpen, numColours, 12, 12,
|
||||
Dropdown::Flag::StayOpen, numColours, squareSize, squareSize,
|
||||
DropdownGetAppropriateImageDropdownItemsPerRow(static_cast<uint32_t>(numColours)));
|
||||
|
||||
gDropdownIsColour = true;
|
||||
|
|
|
@ -160,6 +160,7 @@ enum WindowOptionsWidgetIdx {
|
|||
WIDX_INVERT_DRAG,
|
||||
WIDX_ZOOM_TO_CURSOR,
|
||||
WIDX_WINDOW_BUTTONS_ON_THE_LEFT,
|
||||
WIDX_TOUCH_MODE,
|
||||
WIDX_HOTKEY_DROPDOWN,
|
||||
WIDX_THEMES_GROUP,
|
||||
WIDX_THEMES_LABEL,
|
||||
|
@ -319,22 +320,23 @@ static Widget window_options_audio_widgets[] = {
|
|||
static Widget window_options_controls_and_interface_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
#define CONTROLS_GROUP_START 53
|
||||
MakeWidget({ 5, CONTROLS_GROUP_START + 0}, {300,107}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CONTROLS_GROUP ), // Controls group
|
||||
MakeWidget({ 5, CONTROLS_GROUP_START + 0}, {300,122}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CONTROLS_GROUP ), // Controls group
|
||||
MakeWidget({ 10, CONTROLS_GROUP_START + 13}, {290, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP ), // Edge scrolling
|
||||
MakeWidget({ 10, CONTROLS_GROUP_START + 30}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_TRAP_MOUSE, STR_TRAP_MOUSE_TIP ), // Trap mouse
|
||||
MakeWidget({ 10, CONTROLS_GROUP_START + 45}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_INVERT_RIGHT_MOUSE_DRAG, STR_INVERT_RIGHT_MOUSE_DRAG_TIP ), // Invert right mouse dragging
|
||||
MakeWidget({ 10, CONTROLS_GROUP_START + 60}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ZOOM_TO_CURSOR, STR_ZOOM_TO_CURSOR_TIP ), // Zoom to cursor
|
||||
MakeWidget({ 10, CONTROLS_GROUP_START + 75}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_WINDOW_BUTTONS_ON_THE_LEFT, STR_WINDOW_BUTTONS_ON_THE_LEFT_TIP), // Window buttons on the left
|
||||
MakeWidget({155, CONTROLS_GROUP_START + 90}, {145, 13}, WindowWidgetType::Button, WindowColour::Secondary, STR_HOTKEY, STR_HOTKEY_TIP ), // Set hotkeys buttons
|
||||
MakeWidget({ 10, CONTROLS_GROUP_START + 90}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_TOUCH_MODE, STR_TOUCH_MODE_TIP ), // Touch mode
|
||||
MakeWidget({155, CONTROLS_GROUP_START + 105}, {145, 13}, WindowWidgetType::Button, WindowColour::Secondary, STR_HOTKEY, STR_HOTKEY_TIP ), // Set hotkeys buttons
|
||||
#undef CONTROLS_GROUP_START
|
||||
#define THEMES_GROUP_START 163
|
||||
#define THEMES_GROUP_START 178
|
||||
MakeWidget({ 5, THEMES_GROUP_START + 0}, {300, 48}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_THEMES_GROUP ), // Themes group
|
||||
MakeWidget({ 10, THEMES_GROUP_START + 14}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_THEMES_LABEL_CURRENT_THEME, STR_CURRENT_THEME_TIP ), // Themes
|
||||
MakeWidget({155, THEMES_GROUP_START + 14}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRING ),
|
||||
MakeWidget({288, THEMES_GROUP_START + 15}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_CURRENT_THEME_TIP ),
|
||||
MakeWidget({155, THEMES_GROUP_START + 30}, {145, 13}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_THEMES_BUTTON, STR_EDIT_THEMES_BUTTON_TIP), // Themes button
|
||||
#undef THEMES_GROUP_START
|
||||
#define TOOLBAR_GROUP_START 215
|
||||
#define TOOLBAR_GROUP_START 230
|
||||
MakeWidget({ 5, TOOLBAR_GROUP_START + 0}, {300, 92}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_TOOLBAR_BUTTONS_GROUP ), // Toolbar buttons group
|
||||
MakeWidget({ 10, TOOLBAR_GROUP_START + 14}, {280, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_SHOW_TOOLBAR_BUTTONS_FOR ),
|
||||
MakeWidget({ 24, TOOLBAR_GROUP_START + 31}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_FINANCES_BUTTON_ON_TOOLBAR, STR_FINANCES_BUTTON_ON_TOOLBAR_TIP ), // Finances
|
||||
|
@ -1599,6 +1601,12 @@ static Widget *window_options_page_widgets[] = {
|
|||
Invalidate();
|
||||
WindowInvalidateAll();
|
||||
break;
|
||||
case WIDX_TOUCH_MODE:
|
||||
gConfigInterface.TouchMode ^= 1;
|
||||
ConfigSaveDefault();
|
||||
Invalidate();
|
||||
WindowInvalidateAll();
|
||||
break;
|
||||
case WIDX_INVERT_DRAG:
|
||||
gConfigGeneral.InvertViewportDrag ^= 1;
|
||||
ConfigSaveDefault();
|
||||
|
@ -1664,6 +1672,7 @@ static Widget *window_options_page_widgets[] = {
|
|||
SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHAT, gConfigInterface.ToolbarShowChat);
|
||||
SetCheckboxValue(WIDX_TOOLBAR_SHOW_ZOOM, gConfigInterface.ToolbarShowZoom);
|
||||
SetCheckboxValue(WIDX_WINDOW_BUTTONS_ON_THE_LEFT, gConfigInterface.WindowButtonsOnTheLeft);
|
||||
SetCheckboxValue(WIDX_TOUCH_MODE, gConfigInterface.TouchMode);
|
||||
|
||||
size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex();
|
||||
const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex);
|
||||
|
|
|
@ -43,6 +43,11 @@ static constexpr bool WindowButtonsOnTheLeftDefault = true;
|
|||
#else
|
||||
static constexpr bool WindowButtonsOnTheLeftDefault = false;
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
static constexpr bool kTouchModeDefault = true;
|
||||
#else
|
||||
static constexpr bool kTouchModeDefault = false;
|
||||
#endif
|
||||
|
||||
namespace Config
|
||||
{
|
||||
|
@ -343,6 +348,7 @@ namespace Config
|
|||
model->ScenarioselectLastTab = reader->GetInt32("scenarioselect_last_tab", 0);
|
||||
model->ListRideVehiclesSeparately = reader->GetBoolean("list_ride_vehicles_separately", false);
|
||||
model->WindowButtonsOnTheLeft = reader->GetBoolean("window_buttons_on_the_left", WindowButtonsOnTheLeftDefault);
|
||||
model->TouchMode = reader->GetBoolean("touch_mode", kTouchModeDefault);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,6 +371,7 @@ namespace Config
|
|||
writer->WriteInt32("scenarioselect_last_tab", model->ScenarioselectLastTab);
|
||||
writer->WriteBoolean("list_ride_vehicles_separately", model->ListRideVehiclesSeparately);
|
||||
writer->WriteBoolean("window_buttons_on_the_left", model->WindowButtonsOnTheLeft);
|
||||
writer->WriteBoolean("touch_mode", model->TouchMode);
|
||||
}
|
||||
|
||||
static void ReadSound(IIniReader* reader)
|
||||
|
|
|
@ -136,6 +136,7 @@ struct InterfaceConfiguration
|
|||
int32_t ScenarioselectLastTab;
|
||||
bool ListRideVehiclesSeparately;
|
||||
bool WindowButtonsOnTheLeft;
|
||||
bool TouchMode;
|
||||
};
|
||||
|
||||
struct SoundConfiguration
|
||||
|
|
|
@ -4045,6 +4045,9 @@ enum : uint16_t
|
|||
|
||||
STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS = 6626,
|
||||
|
||||
STR_TOUCH_MODE = 6627,
|
||||
STR_TOUCH_MODE_TIP = 6628,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
|
||||
};
|
||||
|
|
|
@ -1625,19 +1625,12 @@ constexpr CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3] = {
|
|||
},
|
||||
};
|
||||
|
||||
static constexpr int8_t right_quarter_turn_3_tiles_sprite_map[] = {
|
||||
0,
|
||||
-1,
|
||||
1,
|
||||
2,
|
||||
};
|
||||
|
||||
void TrackPaintUtilRightQuarterTurn3TilesPaint(
|
||||
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
|
||||
const ImageId colourFlags, const uint32_t sprites[4][3], const CoordsXY offsets[4][3], const CoordsXY boundsLengths[4][3],
|
||||
const CoordsXYZ boundsOffsets[4][3])
|
||||
{
|
||||
int32_t index = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1665,7 +1658,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint2WithHeightOffset(
|
|||
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
|
||||
const ImageId colourFlags, const uint32_t sprites[4][3], int32_t heightOffset)
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1753,7 +1746,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint3(
|
|||
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
|
||||
const SpriteBb sprites[4][3])
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1770,7 +1763,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint4(
|
|||
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
|
||||
const SpriteBb sprites[4][3])
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -258,6 +258,8 @@ extern const CoordsXY defaultRightQuarterTurn3TilesOffsets[4][3];
|
|||
extern const CoordsXYZ defaultRightQuarterTurn3TilesBoundOffsets[4][3];
|
||||
extern const CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3];
|
||||
|
||||
constexpr int8_t kRightQuarterTurn3TilesSpriteMap[] = { 0, -1, 1, 2 };
|
||||
|
||||
extern const CoordsXY defaultRightHelixUpSmallQuarterBoundLengths[4][3][2];
|
||||
extern const CoordsXYZ defaultRightHelixUpSmallQuarterBoundOffsets[4][3][2];
|
||||
|
||||
|
|
|
@ -1392,9 +1392,7 @@ static void PaintMiniatureRailwayTrackRightQuarterTurn3Tiles(
|
|||
miniature_railway_right_quarter_turn_3_tile_track_floor, nullptr, defaultRightQuarterTurn3TilesBoundLengths,
|
||||
miniature_railway_right_quarter_turn_3_tile_bound_offsets);
|
||||
|
||||
static constexpr int8_t _right_quarter_turn_3_tiles_sprite_map[] = { 0, -1, 1, 2 };
|
||||
|
||||
int32_t index = _right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
|
||||
auto imageId = session.TrackColours.WithIndex(
|
||||
miniature_railway_track_pieces_flat_quarter_turn_3_tiles[direction][index]);
|
||||
|
|
Loading…
Reference in New Issue