mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #691. Relocate windows on a resize of the window
This commit is contained in:
parent
e2b2c94ca1
commit
7e2da48717
|
@ -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();
|
||||
|
|
|
@ -286,7 +286,7 @@ static void osinterface_resize(int width, int height)
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32) = (height >> 3) + 1;
|
||||
|
||||
window_resize_gui(width, height);
|
||||
//RCT2_CALLPROC_EBPSAFE(0x0066B905); // resize_gui()
|
||||
window_relocate_windows(width, height);
|
||||
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue