Implemented window_resize_gui.

This commit is contained in:
Duncan Frost 2014-07-29 19:40:06 +01:00
parent 3acb1a72ba
commit 101324ebc0
3 changed files with 66 additions and 8 deletions

View File

@ -193,6 +193,7 @@ static void osinterface_create_window()
osinterface_resize(width, height);
}
static void osinterface_resize(int width, int height)
{
rct_drawpixelinfo *screenDPI;
@ -250,14 +251,9 @@ static void osinterface_resize(int width, int height)
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) = (width >> 6) + 1;
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32) = (height >> 3) + 1;
RCT2_CALLPROC_EBPSAFE(0x0066B905); // resize_gui()
//This part is to be moved inside resize_gui when it is decompiled.
rct_window* w = window_get_main();
if (w != NULL && w->widgets != NULL){
//Adjust the viewport widget
w->widgets[0].right = width;
w->widgets[0].bottom = height;
}
window_resize_gui(width, height);
//RCT2_CALLPROC_EBPSAFE(0x0066B905); // resize_gui()
gfx_invalidate_screen();
}

View File

@ -1300,3 +1300,64 @@ void window_bubble_list_item(rct_window* w, int item_position){
w->list_item_positions[item_position] = w->list_item_positions[item_position + 1];
w->list_item_positions[item_position + 1] = swap;
}
/**
* rct2: 0x0066B905
*/
void window_resize_gui(int width, int height)
{
if (RCT2_GLOBAL(0x9DEA68, uint8) & 0xE){
//Scenario editor version
RCT2_CALLPROC_EBPSAFE(0x66F0DD);
}
rct_window* mainWind = window_get_main();
if (mainWind){
rct_viewport* viewport = mainWind->viewport;
mainWind->width = width;
mainWind->height = height;
RCT2_GLOBAL(0x9A9418, uint16) = width - 1;
RCT2_GLOBAL(0x9A941C, uint16) = height - 1;
viewport->width = width;
viewport->height = height;
viewport->view_width = width << viewport->zoom;
viewport->view_height = height << viewport->zoom;
if (mainWind->widgets != NULL && mainWind->widgets[0].type == WWT_VIEWPORT){
mainWind->widgets[0].right = width;
mainWind->widgets[0].bottom = height;
}
}
rct_window* topWind = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (topWind){
topWind->width = max(640, width);
}
rct_window* bottomWind = window_find_by_id(WC_BOTTOM_TOOLBAR, 0);
if (bottomWind){
bottomWind->y = height - 32;
bottomWind->width = max(640, width);
RCT2_GLOBAL(0x9A95D0, uint16) = width - 1;
RCT2_GLOBAL(0x9A95E0, uint16) = width - 3;
RCT2_GLOBAL(0x9A95DE, uint16) = width - 118;
RCT2_GLOBAL(0x9A95CE, uint16) = width - 120;
RCT2_GLOBAL(0x9A9590, uint16) = width - 121;
RCT2_GLOBAL(0x9A95A0, uint16) = width - 123;
RCT2_GLOBAL(0x9A95C0, uint16) = width - 126;
RCT2_GLOBAL(0x9A95BE, uint16) = width - 149;
RCT2_GLOBAL(0x9A95EE, uint16) = width - 118;
RCT2_GLOBAL(0x9A95F0, uint16) = width - 3;
}
rct_window* titleWind = window_find_by_id(WC_TITLE_MENU, 0);
if (titleWind){
titleWind->x = width / 2 - 164;
titleWind->y = height - 142;
}
rct_window* exitWind = window_find_by_id(WC_TITLE_EXIT, 0);
if (exitWind){
exitWind->x = width - 40;
exitWind->y = height - 64;
}
}

View File

@ -345,6 +345,7 @@ void tool_cancel();
// Open window functions
void window_main_open();
void window_resize_gui(int width, int height);
void window_game_top_toolbar_open();
void window_game_bottom_toolbar_open();
void window_about_open();