Reset Window now exit fullscreen

Change configFullscreen to configWindow.fullscreen
This commit is contained in:
Heaven Volkoff 2020-05-17 23:29:41 -03:00
parent 9927b3555d
commit 98efed7c51
4 changed files with 14 additions and 11 deletions

View File

@ -216,7 +216,7 @@ static struct Option optsControls[] = {
};
static struct Option optsVideo[] = {
DEF_OPT_TOGGLE( optsVideoStr[0], &configFullscreen ),
DEF_OPT_TOGGLE( optsVideoStr[0], &configWindow.fullscreen ),
DEF_OPT_CHOICE( optsVideoStr[1], &configFiltering, filterChoices ),
DEF_OPT_BUTTON( optsVideoStr[4], optvide_reset_window ),
};

View File

@ -35,7 +35,6 @@ struct ConfigOption {
*/
// Video/audio stuff
bool configFullscreen = false;
ConfigWindow configWindow = {
.x = SDL_WINDOWPOS_CENTERED,
.y = SDL_WINDOWPOS_CENTERED,
@ -43,6 +42,7 @@ ConfigWindow configWindow = {
.h = DESIRED_SCREEN_HEIGHT,
.reset = false,
.vsync = false,
.fullscreen = false,
.exiting_fullscreen = false,
};
unsigned int configFiltering = 1; // 0=force nearest, 1=linear, (TODO) 2=three-point
@ -79,7 +79,7 @@ bool configCameraMouse = false;
unsigned int configSkipIntro = 0;
static const struct ConfigOption options[] = {
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configFullscreen},
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
{.name = "window_x", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.x},
{.name = "window_y", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.y},
{.name = "window_w", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.w},

View File

@ -11,10 +11,10 @@ typedef struct {
unsigned int x, y, w, h;
bool reset;
bool vsync;
bool fullscreen;
bool exiting_fullscreen;
} ConfigWindow;
extern bool configFullscreen;
extern ConfigWindow configWindow;
extern unsigned int configFiltering;
extern unsigned int configMasterVolume;

View File

@ -97,9 +97,9 @@ const SDL_Scancode scancode_rmapping_nonextended[][2] = {
#define IS_FULLSCREEN (SDL_GetWindowFlags(wnd) & SDL_WINDOW_FULLSCREEN_DESKTOP)
static void gfx_sdl_set_fullscreen() {
if (configFullscreen == IS_FULLSCREEN)
if (configWindow.fullscreen == IS_FULLSCREEN)
return;
if (configFullscreen) {
if (configWindow.fullscreen) {
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_ShowCursor(SDL_DISABLE);
} else {
@ -119,7 +119,10 @@ static void gfx_sdl_reset_dimension_and_pos() {
configWindow.h = DESIRED_SCREEN_HEIGHT;
configWindow.reset = false;
if (IS_FULLSCREEN) return;
if (IS_FULLSCREEN) {
configWindow.fullscreen = false;
return;
}
} else
return;
@ -161,7 +164,7 @@ static void gfx_sdl_init(void) {
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
if (gCLIOpts.FullScreen)
configFullscreen = true;
configWindow.fullscreen = true;
const char* window_title =
#ifndef USE_GLES
@ -221,9 +224,9 @@ static void gfx_sdl_onkeydown(int scancode) {
const Uint8 *state = SDL_GetKeyboardState(NULL);
if (state[SDL_SCANCODE_LALT] && state[SDL_SCANCODE_RETURN])
configFullscreen = !configFullscreen;
else if (state[SDL_SCANCODE_ESCAPE] && configFullscreen)
configFullscreen = false;
configWindow.fullscreen = !configWindow.fullscreen;
else if (state[SDL_SCANCODE_ESCAPE] && configWindow.fullscreen)
configWindow.fullscreen = false;
}
static void gfx_sdl_onkeyup(int scancode) {