From 461c14e17a2d14fdd1689adce406e688dcbe2723 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Wed, 31 Jan 2001 13:59:23 +0000 Subject: [PATCH] Fullscreen toggle added to screen res menu --- include/gr.h | 20 +++++++++++++++++++- main/menu.c | 19 ++++++++++++++++++- video/sdl_gr.c | 13 +++++++++---- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/include/gr.h b/include/gr.h index 269874cc..bafc214a 100644 --- a/include/gr.h +++ b/include/gr.h @@ -462,6 +462,24 @@ extern void gr_merge_textures_3( ubyte * lower, ubyte * upper, ubyte * dest ); extern void gr_update(void); -#endif +/* + * currently SDL and OGL are the only things that supports toggling + * fullscreen. otherwise add other checks to the #if -MPM + */ +#if (defined(SDL_VIDEO) || defined(OGL)) +#define GR_SUPPORTS_FULLSCREEN_TOGGLE + +/* + * must return 0 if windowed, 1 if fullscreen + */ +int gr_check_fullscreen(void); +/* + * returns state after toggling (ie, same as if you had called + * check_fullscreen immediatly after) + */ +int gr_toggle_fullscreen(void); + +#endif +#endif diff --git a/main/menu.c b/main/menu.c index cda2f94e..6ac3a25e 100644 --- a/main/menu.c +++ b/main/menu.c @@ -897,7 +897,12 @@ void do_screen_res_menu() void do_screen_res_menu() { - #define N_SCREENRES_ITEMS 9 +#ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE +#define N_SCREENRES_ITEMS 10 + int fullscreenc; +#else + #define N_SCREENRES_ITEMS 9 +#endif newmenu_item m[N_SCREENRES_ITEMS]; int citem; int i; @@ -939,6 +944,12 @@ void do_screen_res_menu() } #endif +#ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE + m[n_items].type = NM_TYPE_CHECK; m[n_items].text = "Fullscreen"; + m[n_items].value = gr_check_fullscreen(); + fullscreenc=n_items++; +#endif + citem = Current_display_mode+1; #ifdef WINDOWS @@ -955,6 +966,12 @@ void do_screen_res_menu() newmenu_do1( NULL, "Select screen mode", n_items, m, NULL, citem); +#ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE + if (m[fullscreenc].value != gr_check_fullscreen()){ + gr_toggle_fullscreen(); + } +#endif + for (i=0;isc_mode=0;//hack to get it to reset screen mode +*/ + SDL_WM_ToggleFullScreen(screen); return (sdl_video_flags & SDL_FULLSCREEN)?1:0; } -- 2.39.2