Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
add a config key for "exclusive" i.e. mode-changing fullscreen (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed Mar 4, 2021
1 parent 36de660 commit ce65528
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
23 changes: 17 additions & 6 deletions prboom2/src/SDL/i_video.c
Expand Up @@ -111,6 +111,7 @@ int gl_depthbuffer_bits=16;
extern void M_QuitDOOM(int choice);
int use_fullscreen;
int desired_fullscreen;
int exclusive_fullscreen;
int render_vsync;
int screen_multiply;
int render_screen_multiply;
Expand Down Expand Up @@ -720,6 +721,10 @@ static void I_FillScreenResolutionsList(void)
// make sure the canonical resolutions are always available
if (i > count - 1)
{
// no hard-coded resolutions for mode-changing fullscreen
if (exclusive_fullscreen)
continue;

mode.w = canonicals[i - count].w;
mode.h = canonicals[i - count].h;
}
Expand Down Expand Up @@ -891,6 +896,10 @@ void I_CalculateRes(int width, int height)
unsigned int count1, count2;
int pitch1, pitch2;

if (desired_fullscreen && exclusive_fullscreen)
{
I_ClosestResolution(&width, &height);
}
SCREENWIDTH = width;//(width+15) & ~15;
SCREENHEIGHT = height;

Expand Down Expand Up @@ -1181,11 +1190,13 @@ void I_UpdateVideoMode(void)
}

// Fullscreen desktop for software renderer only - DTIED
if (desired_fullscreen && V_GetMode() != VID_MODEGL)
init_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
else
if ( desired_fullscreen )
init_flags |= SDL_WINDOW_FULLSCREEN;
if (desired_fullscreen)
{
if (V_GetMode() == VID_MODEGL || exclusive_fullscreen)
init_flags |= SDL_WINDOW_FULLSCREEN;
else
init_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}

// In windowed mode, the window can be resized while the game is
// running. This feature is disabled on OS X, as it adds an ugly
Expand Down Expand Up @@ -1260,7 +1271,7 @@ void I_UpdateVideoMode(void)
}

// [FG] apply screen_multiply to initial window size
if (!(init_flags & SDL_WINDOW_FULLSCREEN_DESKTOP))
if (!desired_fullscreen)
{
SDL_SetWindowSize(sdl_window, screen_multiply*SCREENWIDTH, screen_multiply*actualheight);
}
Expand Down
1 change: 1 addition & 0 deletions prboom2/src/i_video.h
Expand Up @@ -102,6 +102,7 @@ void I_StartFrame (void);

extern int use_fullscreen; /* proff 21/05/2000 */
extern int desired_fullscreen; //e6y
extern int exclusive_fullscreen;

void I_UpdateRenderSize(void); // Handle potential
extern int renderW; // resolution scaling
Expand Down
4 changes: 3 additions & 1 deletion prboom2/src/m_misc.c
Expand Up @@ -464,6 +464,8 @@ default_t defaults[] =
{"screen_resolution",{NULL, &screen_resolution},{0,"640x480"},UL,UL,def_str,ss_none},
{"use_fullscreen",{&use_fullscreen},{0},0,1, /* proff 21/05/2000 */
def_bool,ss_none},
{"exclusive_fullscreen",{&exclusive_fullscreen},{0},0,1, // [FG] mode-changing fullscreen
def_bool,ss_none},
{"render_vsync",{&render_vsync},{1},0,1,
def_bool,ss_none},
{"translucency",{&default_translucency},{1},0,1, // phares
Expand Down Expand Up @@ -1065,7 +1067,7 @@ default_t defaults[] =
def_bool,ss_stat},
{"render_wipescreen", {&render_wipescreen}, {1},0,1,
def_bool,ss_stat},
{"render_screen_multiply", {&render_screen_multiply}, {1},1,4,
{"render_screen_multiply", {&render_screen_multiply}, {1},1,5,
def_int,ss_stat},
{"integer_scaling", {&integer_scaling}, {0},0,1,
def_bool,ss_stat},
Expand Down

0 comments on commit ce65528

Please sign in to comment.