mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #5531 from Gymnasiast/fix/837
Create define for top toolbar clearance and fix #837
This commit is contained in:
commit
eb0b29bcfe
|
@ -508,7 +508,7 @@ static bool window_fits_on_screen(sint32 x, sint32 y, sint32 width, sint32 heigh
|
||||||
if (x < unk) return false;
|
if (x < unk) return false;
|
||||||
unk = screenWidth + (unk * 2);
|
unk = screenWidth + (unk * 2);
|
||||||
if (x > unk) return false;
|
if (x > unk) return false;
|
||||||
if (y < 28) return false;
|
if (y <= TOP_TOOLBAR_HEIGHT && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) return false;
|
||||||
unk = screenHeight - (height / 4);
|
unk = screenHeight - (height / 4);
|
||||||
if (y > unk) return false;
|
if (y > unk) return false;
|
||||||
return window_fits_between_others(x, y, width, height);
|
return window_fits_between_others(x, y, width, height);
|
||||||
|
@ -526,7 +526,7 @@ static bool window_fits_on_screen(sint32 x, sint32 y, sint32 width, sint32 heigh
|
||||||
static bool window_fits_within_space(sint32 x, sint32 y, sint32 width, sint32 height)
|
static bool window_fits_within_space(sint32 x, sint32 y, sint32 width, sint32 height)
|
||||||
{
|
{
|
||||||
if (x < 0) return false;
|
if (x < 0) return false;
|
||||||
if (y < 28) return false;
|
if (y <= TOP_TOOLBAR_HEIGHT && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) return false;
|
||||||
if (x + width > context_get_width()) return false;
|
if (x + width > context_get_width()) return false;
|
||||||
if (y + height > context_get_height()) return false;
|
if (y + height > context_get_height()) return false;
|
||||||
return window_fits_between_others(x, y, width, height);
|
return window_fits_between_others(x, y, width, height);
|
||||||
|
@ -695,7 +695,7 @@ rct_window * window_create_centred(sint32 width, sint32 height, rct_window_event
|
||||||
sint32 screenHeight = context_get_height();
|
sint32 screenHeight = context_get_height();
|
||||||
|
|
||||||
sint32 x = (screenWidth - width) / 2;
|
sint32 x = (screenWidth - width) / 2;
|
||||||
sint32 y = max(28, (screenHeight - height) / 2);
|
sint32 y = max(TOP_TOOLBAR_HEIGHT + 1, (screenHeight - height) / 2);
|
||||||
return window_create(x, y, width, height, event_handlers, cls, flags);
|
return window_create(x, y, width, height, event_handlers, cls, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2117,7 +2117,7 @@ void window_relocate_windows(sint32 width, sint32 height){
|
||||||
sint32 x = w->x;
|
sint32 x = w->x;
|
||||||
sint32 y = w->y;
|
sint32 y = w->y;
|
||||||
w->x = new_location;
|
w->x = new_location;
|
||||||
w->y = new_location + 28;
|
w->y = new_location + TOP_TOOLBAR_HEIGHT + 1;
|
||||||
|
|
||||||
// Move the next new location so windows are not directly on top
|
// Move the next new location so windows are not directly on top
|
||||||
new_location += 8;
|
new_location += 8;
|
||||||
|
@ -2448,8 +2448,9 @@ void window_move_and_snap(rct_window *w, sint32 newWindowX, sint32 newWindowY, s
|
||||||
{
|
{
|
||||||
sint32 originalX = w->x;
|
sint32 originalX = w->x;
|
||||||
sint32 originalY = w->y;
|
sint32 originalY = w->y;
|
||||||
|
sint32 minY = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 1 : TOP_TOOLBAR_HEIGHT + 2;
|
||||||
|
|
||||||
newWindowY = clamp(29, newWindowY, context_get_height() - 34);
|
newWindowY = clamp(minY, newWindowY, context_get_height() - 34);
|
||||||
|
|
||||||
if (snapProximity > 0) {
|
if (snapProximity > 0) {
|
||||||
w->x = newWindowX;
|
w->x = newWindowX;
|
||||||
|
|
|
@ -36,6 +36,7 @@ struct TitleSequence;
|
||||||
struct TextInputSession;
|
struct TextInputSession;
|
||||||
|
|
||||||
#define TEXT_INPUT_SIZE 1024
|
#define TEXT_INPUT_SIZE 1024
|
||||||
|
#define TOP_TOOLBAR_HEIGHT 27
|
||||||
|
|
||||||
extern uint16 TextInputDescriptionArgs[4];
|
extern uint16 TextInputDescriptionArgs[4];
|
||||||
extern char gTextBoxInput[TEXT_INPUT_SIZE];
|
extern char gTextBoxInput[TEXT_INPUT_SIZE];
|
||||||
|
|
|
@ -129,7 +129,7 @@ void window_install_track_open(const utf8 *path)
|
||||||
sint32 screenWidth = context_get_width();
|
sint32 screenWidth = context_get_width();
|
||||||
sint32 screenHeight = context_get_height();
|
sint32 screenHeight = context_get_height();
|
||||||
sint32 x = screenWidth / 2 - 201;
|
sint32 x = screenWidth / 2 - 201;
|
||||||
sint32 y = max(28, screenHeight / 2 - 200);
|
sint32 y = max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200);
|
||||||
|
|
||||||
rct_window *w = window_create(x, y, 402, 400, &window_install_track_events, WC_INSTALL_TRACK, 0);
|
rct_window *w = window_create(x, y, 402, 400, &window_install_track_events, WC_INSTALL_TRACK, 0);
|
||||||
w->widgets = window_install_track_widgets;
|
w->widgets = window_install_track_widgets;
|
||||||
|
|
|
@ -189,33 +189,33 @@ static const sint32 right_aligned_widgets_order[] = {
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
static rct_widget window_top_toolbar_widgets[] = {
|
static rct_widget window_top_toolbar_widgets[] = {
|
||||||
{ WWT_TRNBTN, 0, 0x0000, 0x001D, 0, 27, 0x20000000 | SPR_TOOLBAR_PAUSE, STR_PAUSE_GAME_TIP }, // Pause
|
{ WWT_TRNBTN, 0, 0x0000, 0x001D, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_PAUSE, STR_PAUSE_GAME_TIP }, // Pause
|
||||||
{ WWT_TRNBTN, 0, 0x001E + 30, 0x003B + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_FILE, STR_DISC_AND_GAME_OPTIONS_TIP }, // File menu
|
{ WWT_TRNBTN, 0, 0x001E + 30, 0x003B + 30, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_FILE, STR_DISC_AND_GAME_OPTIONS_TIP }, // File menu
|
||||||
{ WWT_TRNBTN, 0, 0x00DC + 30, 0x00F9 + 30, 0, 27, 0x20000000 | SPR_G2_TOOLBAR_MUTE, STR_TOOLBAR_MUTE_TIP }, // Mute
|
{ WWT_TRNBTN, 0, 0x00DC + 30, 0x00F9 + 30, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_G2_TOOLBAR_MUTE, STR_TOOLBAR_MUTE_TIP }, // Mute
|
||||||
{ WWT_TRNBTN, 1, 0x0046 + 30, 0x0063 + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_ZOOM_OUT, STR_ZOOM_OUT_TIP }, // Zoom out
|
{ WWT_TRNBTN, 1, 0x0046 + 30, 0x0063 + 30, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_ZOOM_OUT, STR_ZOOM_OUT_TIP }, // Zoom out
|
||||||
{ WWT_TRNBTN, 1, 0x0064 + 30, 0x0081 + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_ZOOM_IN, STR_ZOOM_IN_TIP }, // Zoom in
|
{ WWT_TRNBTN, 1, 0x0064 + 30, 0x0081 + 30, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_ZOOM_IN, STR_ZOOM_IN_TIP }, // Zoom in
|
||||||
{ WWT_TRNBTN, 1, 0x0082 + 30, 0x009F + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_ROTATE, STR_ROTATE_TIP }, // Rotate camera
|
{ WWT_TRNBTN, 1, 0x0082 + 30, 0x009F + 30, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_ROTATE, STR_ROTATE_TIP }, // Rotate camera
|
||||||
{ WWT_TRNBTN, 1, 0x00A0 + 30, 0x00BD + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_VIEW, STR_VIEW_OPTIONS_TIP }, // Transparency menu
|
{ WWT_TRNBTN, 1, 0x00A0 + 30, 0x00BD + 30, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_VIEW, STR_VIEW_OPTIONS_TIP }, // Transparency menu
|
||||||
{ WWT_TRNBTN, 1, 0x00BE + 30, 0x00DB + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_MAP, STR_SHOW_MAP_TIP }, // Map
|
{ WWT_TRNBTN, 1, 0x00BE + 30, 0x00DB + 30, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_MAP, STR_SHOW_MAP_TIP }, // Map
|
||||||
{ WWT_TRNBTN, 2, 0x010B, 0x0128, 0, 27, 0x20000000 | SPR_TOOLBAR_LAND, STR_ADJUST_LAND_TIP }, // Land
|
{ WWT_TRNBTN, 2, 0x010B, 0x0128, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_LAND, STR_ADJUST_LAND_TIP }, // Land
|
||||||
{ WWT_TRNBTN, 2, 0x0129, 0x0146, 0, 27, 0x20000000 | SPR_TOOLBAR_WATER, STR_ADJUST_WATER_TIP }, // Water
|
{ WWT_TRNBTN, 2, 0x0129, 0x0146, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_WATER, STR_ADJUST_WATER_TIP }, // Water
|
||||||
{ WWT_TRNBTN, 2, 0x0147, 0x0164, 0, 27, 0x20000000 | SPR_TOOLBAR_SCENERY, STR_PLACE_SCENERY_TIP }, // Scenery
|
{ WWT_TRNBTN, 2, 0x0147, 0x0164, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_SCENERY, STR_PLACE_SCENERY_TIP }, // Scenery
|
||||||
{ WWT_TRNBTN, 2, 0x0165, 0x0182, 0, 27, 0x20000000 | SPR_TOOLBAR_FOOTPATH, STR_BUILD_FOOTPATH_TIP }, // Path
|
{ WWT_TRNBTN, 2, 0x0165, 0x0182, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_FOOTPATH, STR_BUILD_FOOTPATH_TIP }, // Path
|
||||||
{ WWT_TRNBTN, 2, 0x0183, 0x01A0, 0, 27, 0x20000000 | SPR_TOOLBAR_CONSTRUCT_RIDE, STR_BUILD_RIDE_TIP }, // Construct ride
|
{ WWT_TRNBTN, 2, 0x0183, 0x01A0, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_CONSTRUCT_RIDE, STR_BUILD_RIDE_TIP }, // Construct ride
|
||||||
{ WWT_TRNBTN, 3, 0x01EA, 0x0207, 0, 27, 0x20000000 | SPR_TOOLBAR_RIDES, STR_RIDES_IN_PARK_TIP }, // Rides
|
{ WWT_TRNBTN, 3, 0x01EA, 0x0207, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_RIDES, STR_RIDES_IN_PARK_TIP }, // Rides
|
||||||
{ WWT_TRNBTN, 3, 0x0208, 0x0225, 0, 27, 0x20000000 | SPR_TOOLBAR_PARK, STR_PARK_INFORMATION_TIP }, // Park
|
{ WWT_TRNBTN, 3, 0x0208, 0x0225, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_PARK, STR_PARK_INFORMATION_TIP }, // Park
|
||||||
{ WWT_TRNBTN, 3, 0x0226, 0x0243, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_STAFF_TIP }, // Staff
|
{ WWT_TRNBTN, 3, 0x0226, 0x0243, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_STAFF_TIP }, // Staff
|
||||||
{ WWT_TRNBTN, 3, 0x0230, 0x024D, 0, 27, 0x20000000 | SPR_TOOLBAR_GUESTS, STR_GUESTS_TIP }, // Guests
|
{ WWT_TRNBTN, 3, 0x0230, 0x024D, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_GUESTS, STR_GUESTS_TIP }, // Guests
|
||||||
{ WWT_TRNBTN, 2, 0x0230, 0x024D, 0, 27, 0x20000000 | SPR_TOOLBAR_CLEAR_SCENERY, STR_CLEAR_SCENERY_TIP }, // Clear scenery
|
{ WWT_TRNBTN, 2, 0x0230, 0x024D, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TOOLBAR_CLEAR_SCENERY, STR_CLEAR_SCENERY_TIP }, // Clear scenery
|
||||||
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_GAME_SPEED_TIP }, // Fast forward
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_GAME_SPEED_TIP }, // Fast forward
|
||||||
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_CHEATS_TIP }, // Cheats
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_CHEATS_TIP }, // Cheats
|
||||||
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_DEBUG_TIP }, // Debug
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_DEBUG_TIP }, // Debug
|
||||||
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_SCENARIO_OPTIONS_FINANCIAL_TIP },// Finances
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_SCENARIO_OPTIONS_FINANCIAL_TIP },// Finances
|
||||||
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_FINANCES_RESEARCH_TIP }, // Research
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_FINANCES_RESEARCH_TIP }, // Research
|
||||||
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_SHOW_RECENT_MESSAGES_TIP }, // News
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_SHOW_RECENT_MESSAGES_TIP }, // News
|
||||||
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | SPR_TAB_TOOLBAR, STR_SHOW_MULTIPLAYER_STATUS_TIP }, // Network
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, 0x20000000 | SPR_TAB_TOOLBAR, STR_SHOW_MULTIPLAYER_STATUS_TIP }, // Network
|
||||||
|
|
||||||
{ WWT_EMPTY, 0, 0, 10-1, 0, 0, 0xFFFFFFFF, STR_NONE }, // Artificial widget separator
|
{ WWT_EMPTY, 0, 0, 10-1, 0, 0, 0xFFFFFFFF, STR_NONE }, // Artificial widget separator
|
||||||
{ WIDGETS_END },
|
{ WIDGETS_END },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ void window_top_toolbar_open()
|
||||||
{
|
{
|
||||||
rct_window * window = window_create(
|
rct_window * window = window_create(
|
||||||
0, 0,
|
0, 0,
|
||||||
context_get_width(), 28,
|
context_get_width(), TOP_TOOLBAR_HEIGHT + 1,
|
||||||
&window_top_toolbar_events,
|
&window_top_toolbar_events,
|
||||||
WC_TOP_TOOLBAR,
|
WC_TOP_TOOLBAR,
|
||||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND
|
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND
|
||||||
|
|
|
@ -125,10 +125,10 @@ void window_track_list_open(ride_list_item item)
|
||||||
sint32 screenWidth = context_get_width();
|
sint32 screenWidth = context_get_width();
|
||||||
sint32 screenHeight = context_get_height();
|
sint32 screenHeight = context_get_height();
|
||||||
x = screenWidth / 2 - 300;
|
x = screenWidth / 2 - 300;
|
||||||
y = max(28, screenHeight / 2 - 200);
|
y = max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200);
|
||||||
} else {
|
} else {
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 29;
|
y = TOP_TOOLBAR_HEIGHT + 2;
|
||||||
}
|
}
|
||||||
rct_window *w = window_create(
|
rct_window *w = window_create(
|
||||||
x,
|
x,
|
||||||
|
|
|
@ -258,7 +258,7 @@ static void window_track_delete_prompt_open()
|
||||||
sint32 screenWidth = context_get_width();
|
sint32 screenWidth = context_get_width();
|
||||||
sint32 screenHeight = context_get_height();
|
sint32 screenHeight = context_get_height();
|
||||||
rct_window *w = window_create(
|
rct_window *w = window_create(
|
||||||
max(28, (screenWidth - 250) / 2),
|
max(TOP_TOOLBAR_HEIGHT + 1, (screenWidth - 250) / 2),
|
||||||
(screenHeight - 44) / 2,
|
(screenHeight - 44) / 2,
|
||||||
250,
|
250,
|
||||||
74,
|
74,
|
||||||
|
|
Loading…
Reference in New Issue