mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Fix #691. Relocate windows on a resize of the window
This commit is contained in:
@@ -1654,6 +1654,38 @@ void window_bubble_list_item(rct_window* w, int item_position){
|
||||
w->list_item_positions[item_position + 1] = swap;
|
||||
}
|
||||
|
||||
/* rct2: 0x006ED710
|
||||
* Called after a window resize to move windows if they
|
||||
* are going to be out of sight.
|
||||
*/
|
||||
void window_relocate_windows(int width, int height){
|
||||
int new_location = 8;
|
||||
for (rct_window* w = g_window_list; w < RCT2_NEW_WINDOW; w++){
|
||||
|
||||
// Work out if the window requires moving
|
||||
if (w->x + 10 < width){
|
||||
if (w->flags&(WF_STICK_TO_BACK | WF_STICK_TO_FRONT)){
|
||||
if (w->y -22 < height)continue;
|
||||
}
|
||||
if (w->y + 10 < height)continue;
|
||||
}
|
||||
|
||||
// Calculate the new locations
|
||||
int x = w->x;
|
||||
int y = w->y;
|
||||
w->x = new_location;
|
||||
w->y = new_location + 28;
|
||||
|
||||
// Move the next new location so windows are not directly on top
|
||||
new_location += 8;
|
||||
|
||||
// Adjust the viewport if required.
|
||||
if (w->viewport){
|
||||
w->viewport->x -= x - w->x;
|
||||
w->viewport->y -= y - w->y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* rct2: 0x0066B905
|
||||
|
||||
@@ -481,6 +481,7 @@ void window_update_viewport_ride_music();
|
||||
|
||||
// Open window functions
|
||||
void window_main_open();
|
||||
void window_relocate_windows(int width, int height);
|
||||
void window_resize_gui(int width, int height);
|
||||
void window_resize_gui_scenario_editor(int width, int height);
|
||||
void window_game_top_toolbar_open();
|
||||
|
||||
Reference in New Issue
Block a user