mirror of https://github.com/OpenRCT2/OpenRCT2.git
Last windowed size is now remembered
Added funciton platform_update_config_window_size() to shared.c Window size is not updated if the window is maximized
This commit is contained in:
parent
b49676a887
commit
40efb2c0d6
|
@ -80,6 +80,7 @@ void platform_process_messages();
|
||||||
int platform_scancode_to_rct_keycode(int sdl_key);
|
int platform_scancode_to_rct_keycode(int sdl_key);
|
||||||
void platform_start_text_input(char* buffer, int max_length);
|
void platform_start_text_input(char* buffer, int max_length);
|
||||||
void platform_stop_text_input();
|
void platform_stop_text_input();
|
||||||
|
void platform_update_config_window_size();
|
||||||
|
|
||||||
// Platform specific definitions
|
// Platform specific definitions
|
||||||
char platform_get_path_separator();
|
char platform_get_path_separator();
|
||||||
|
|
|
@ -453,6 +453,23 @@ static void platform_close_window()
|
||||||
platform_unload_cursors();
|
platform_unload_cursors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform_update_config_window_size()
|
||||||
|
{
|
||||||
|
// Check if the window has been resized in windowed mode and update the config file accordingly
|
||||||
|
// This is called in rct2_update_2 and is only called after resizing a window has finished
|
||||||
|
int width, height;
|
||||||
|
uint32 flags = SDL_GetWindowFlags(gWindow);
|
||||||
|
if ((flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED |
|
||||||
|
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)) == 0) {
|
||||||
|
SDL_GetWindowSize(gWindow, &width, &height);
|
||||||
|
if (width != gConfigGeneral.window_width || height != gConfigGeneral.window_height) {
|
||||||
|
gConfigGeneral.window_width = width;
|
||||||
|
gConfigGeneral.window_height = height;
|
||||||
|
config_save_default();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void platform_init()
|
void platform_init()
|
||||||
{
|
{
|
||||||
platform_create_window();
|
platform_create_window();
|
||||||
|
|
|
@ -345,6 +345,9 @@ void rct2_update_2()
|
||||||
title_update();
|
title_update();
|
||||||
else
|
else
|
||||||
game_update();
|
game_update();
|
||||||
|
|
||||||
|
// Update the windowed mode size in the config file if needed
|
||||||
|
platform_update_config_window_size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void rct2_endupdate()
|
void rct2_endupdate()
|
||||||
|
|
Loading…
Reference in New Issue