mirror of https://github.com/sm64pc/sm64pc.git
Reset Window now exit fullscreen
Change configFullscreen to configWindow.fullscreen
This commit is contained in:
parent
9927b3555d
commit
98efed7c51
|
@ -216,7 +216,7 @@ static struct Option optsControls[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct Option optsVideo[] = {
|
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_CHOICE( optsVideoStr[1], &configFiltering, filterChoices ),
|
||||||
DEF_OPT_BUTTON( optsVideoStr[4], optvide_reset_window ),
|
DEF_OPT_BUTTON( optsVideoStr[4], optvide_reset_window ),
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,6 @@ struct ConfigOption {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Video/audio stuff
|
// Video/audio stuff
|
||||||
bool configFullscreen = false;
|
|
||||||
ConfigWindow configWindow = {
|
ConfigWindow configWindow = {
|
||||||
.x = SDL_WINDOWPOS_CENTERED,
|
.x = SDL_WINDOWPOS_CENTERED,
|
||||||
.y = SDL_WINDOWPOS_CENTERED,
|
.y = SDL_WINDOWPOS_CENTERED,
|
||||||
|
@ -43,6 +42,7 @@ ConfigWindow configWindow = {
|
||||||
.h = DESIRED_SCREEN_HEIGHT,
|
.h = DESIRED_SCREEN_HEIGHT,
|
||||||
.reset = false,
|
.reset = false,
|
||||||
.vsync = false,
|
.vsync = false,
|
||||||
|
.fullscreen = false,
|
||||||
.exiting_fullscreen = false,
|
.exiting_fullscreen = false,
|
||||||
};
|
};
|
||||||
unsigned int configFiltering = 1; // 0=force nearest, 1=linear, (TODO) 2=three-point
|
unsigned int configFiltering = 1; // 0=force nearest, 1=linear, (TODO) 2=three-point
|
||||||
|
@ -79,7 +79,7 @@ bool configCameraMouse = false;
|
||||||
unsigned int configSkipIntro = 0;
|
unsigned int configSkipIntro = 0;
|
||||||
|
|
||||||
static const struct ConfigOption options[] = {
|
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_x", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.x},
|
||||||
{.name = "window_y", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.y},
|
{.name = "window_y", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.y},
|
||||||
{.name = "window_w", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.w},
|
{.name = "window_w", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.w},
|
||||||
|
|
|
@ -11,10 +11,10 @@ typedef struct {
|
||||||
unsigned int x, y, w, h;
|
unsigned int x, y, w, h;
|
||||||
bool reset;
|
bool reset;
|
||||||
bool vsync;
|
bool vsync;
|
||||||
|
bool fullscreen;
|
||||||
bool exiting_fullscreen;
|
bool exiting_fullscreen;
|
||||||
} ConfigWindow;
|
} ConfigWindow;
|
||||||
|
|
||||||
extern bool configFullscreen;
|
|
||||||
extern ConfigWindow configWindow;
|
extern ConfigWindow configWindow;
|
||||||
extern unsigned int configFiltering;
|
extern unsigned int configFiltering;
|
||||||
extern unsigned int configMasterVolume;
|
extern unsigned int configMasterVolume;
|
||||||
|
|
|
@ -97,9 +97,9 @@ const SDL_Scancode scancode_rmapping_nonextended[][2] = {
|
||||||
#define IS_FULLSCREEN (SDL_GetWindowFlags(wnd) & SDL_WINDOW_FULLSCREEN_DESKTOP)
|
#define IS_FULLSCREEN (SDL_GetWindowFlags(wnd) & SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||||
|
|
||||||
static void gfx_sdl_set_fullscreen() {
|
static void gfx_sdl_set_fullscreen() {
|
||||||
if (configFullscreen == IS_FULLSCREEN)
|
if (configWindow.fullscreen == IS_FULLSCREEN)
|
||||||
return;
|
return;
|
||||||
if (configFullscreen) {
|
if (configWindow.fullscreen) {
|
||||||
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -119,7 +119,10 @@ static void gfx_sdl_reset_dimension_and_pos() {
|
||||||
configWindow.h = DESIRED_SCREEN_HEIGHT;
|
configWindow.h = DESIRED_SCREEN_HEIGHT;
|
||||||
configWindow.reset = false;
|
configWindow.reset = false;
|
||||||
|
|
||||||
if (IS_FULLSCREEN) return;
|
if (IS_FULLSCREEN) {
|
||||||
|
configWindow.fullscreen = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -161,7 +164,7 @@ static void gfx_sdl_init(void) {
|
||||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||||
|
|
||||||
if (gCLIOpts.FullScreen)
|
if (gCLIOpts.FullScreen)
|
||||||
configFullscreen = true;
|
configWindow.fullscreen = true;
|
||||||
|
|
||||||
const char* window_title =
|
const char* window_title =
|
||||||
#ifndef USE_GLES
|
#ifndef USE_GLES
|
||||||
|
@ -221,9 +224,9 @@ static void gfx_sdl_onkeydown(int scancode) {
|
||||||
const Uint8 *state = SDL_GetKeyboardState(NULL);
|
const Uint8 *state = SDL_GetKeyboardState(NULL);
|
||||||
|
|
||||||
if (state[SDL_SCANCODE_LALT] && state[SDL_SCANCODE_RETURN])
|
if (state[SDL_SCANCODE_LALT] && state[SDL_SCANCODE_RETURN])
|
||||||
configFullscreen = !configFullscreen;
|
configWindow.fullscreen = !configWindow.fullscreen;
|
||||||
else if (state[SDL_SCANCODE_ESCAPE] && configFullscreen)
|
else if (state[SDL_SCANCODE_ESCAPE] && configWindow.fullscreen)
|
||||||
configFullscreen = false;
|
configWindow.fullscreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_sdl_onkeyup(int scancode) {
|
static void gfx_sdl_onkeyup(int scancode) {
|
||||||
|
|
Loading…
Reference in New Issue