From 8cc0540b60f6af4cad99060e8cb0b5920b96e52b Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Mon, 13 May 2024 21:23:14 +0200 Subject: resolution and fullscreen config working --- main.c | 12 ++++++++++-- src/menu.c | 12 ++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index cb84277..e5b7746 100644 --- a/main.c +++ b/main.c @@ -93,13 +93,21 @@ int main(int argc, char **argv) { platform_init(argc, argv, CONFIG_DIRECTORY); + is_fullscreen = settings_get_number_or_default("FULLSCRN", 1); + current_res_index = settings_get_number_or_default("RES_INDEX", 2); + + printf("%d %d x %d\n", current_res_index, available_resolutions[current_res_index].x, + available_resolutions[current_res_index].y); + settings_set_number("USE_GPU", 1); platform_window *window = platform_open_window_ex("Zombies!", available_resolutions[current_res_index].x, available_resolutions[current_res_index].y, UINT16_MAX, UINT16_MAX, 1366, 768, FLAGS_MINIMIZE, update_func, 0, 0, 0, 0); - platform_toggle_vsync(window, false); - //platform_toggle_fullscreen(window, true); + platform_toggle_vsync(window, true); + if (is_fullscreen) platform_toggle_fullscreen(window, is_fullscreen); + //platform_window_set_size(window, available_resolutions[current_res_index].x, + // available_resolutions[current_res_index].y); settings_set_number("USE_GPU", 1); diff --git a/src/menu.c b/src/menu.c index 0f6bb0b..222679f 100644 --- a/src/menu.c +++ b/src/menu.c @@ -286,6 +286,12 @@ void draw_settings(platform_window* window) if (current_res_index < 0) // Loop around current_res_index = sizeof(available_resolutions)/sizeof(vec2)-1; + if (is_fullscreen) { + is_fullscreen = 0; + settings_set_number("FULLSCRN", is_fullscreen); + platform_toggle_fullscreen(window, is_fullscreen); + } + settings_set_number("RES_INDEX", current_res_index); platform_window_set_size(window, available_resolutions[current_res_index].x, available_resolutions[current_res_index].y); } @@ -297,6 +303,12 @@ void draw_settings(platform_window* window) if (current_res_index >= sizeof(available_resolutions)/sizeof(vec2)) // Loop around current_res_index = 0; + if (is_fullscreen) { + is_fullscreen = 0; + settings_set_number("FULLSCRN", is_fullscreen); + platform_toggle_fullscreen(window, is_fullscreen); + } + settings_set_number("RES_INDEX", current_res_index); platform_window_set_size(window, available_resolutions[current_res_index].x, available_resolutions[current_res_index].y); } -- cgit v1.2.3-70-g09d2