Pause on Minimized/Focus Lost is now in the options menu

This commit is contained in:
Rykita 2023-05-24 16:42:36 +02:00
parent 218ac53ce9
commit 8cbbfaae9e
2 changed files with 18 additions and 3 deletions

View File

@ -732,8 +732,8 @@ IN_Update(void)
Cvar_SetValue("paused", 0);
}
}
else if (event.window.event == SDL_WINDOWEVENT_MINIMIZED ||
event.window.event == SDL_WINDOWEVENT_HIDDEN)
else if (event.window.event == SDL_WINDOWEVENT_MINIMIZED && windowed_pauseonfocuslost->value > 0 ||
event.window.event == SDL_WINDOWEVENT_HIDDEN && windowed_pauseonfocuslost->value > 0)
{
Cvar_SetValue("paused", 1);
}
@ -2322,7 +2322,7 @@ IN_Init(void)
gyro_active = true;
}
windowed_pauseonfocuslost = Cvar_Get("windowed_pauseonfocuslost", "0", CVAR_USERINFO | CVAR_ARCHIVE);
windowed_pauseonfocuslost = Cvar_Get("w_pauseonfocuslost", "0", CVAR_USERINFO | CVAR_ARCHIVE);
windowed_mouse = Cvar_Get("windowed_mouse", "1", CVAR_USERINFO | CVAR_ARCHIVE);
Cmd_AddCommand("+mlook", IN_MLookDown);

View File

@ -2154,6 +2154,7 @@ static menuslider_s s_options_oggvolume_slider;
static menulist_s s_options_oggenable_box;
static menulist_s s_options_quality_list;
static menulist_s s_options_console_action;
static menulist_s s_options_pauseonfocus_box;
static void
CrosshairFunc(void *unused)
@ -2161,6 +2162,12 @@ CrosshairFunc(void *unused)
Cvar_SetValue("crosshair", (float)s_options_crosshair_box.curvalue);
}
static void
PauseFocusFunc()
{
Cvar_SetValue("w_pauseonfocuslost", (float)s_options_pauseonfocus_box.curvalue);
}
static void
CustomizeControlsFunc(void *unused)
{
@ -2432,6 +2439,13 @@ Options_MenuInit(void)
s_options_crosshair_box.generic.name = "crosshair";
s_options_crosshair_box.generic.callback = CrosshairFunc;
s_options_crosshair_box.itemnames = crosshair_names;
s_options_pauseonfocus_box.generic.type = MTYPE_SPINCONTROL;
s_options_pauseonfocus_box.generic.x = 0;
s_options_pauseonfocus_box.generic.y = (y += 10);
s_options_pauseonfocus_box.generic.name = "pause on minimized";
s_options_pauseonfocus_box.generic.callback = PauseFocusFunc;
s_options_pauseonfocus_box.itemnames = yesno_names;
y += 10;
if (show_gamepad)
@ -2475,6 +2489,7 @@ Options_MenuInit(void)
Menu_AddItem(&s_options_menu, (void *)&s_options_lookstrafe_box);
Menu_AddItem(&s_options_menu, (void *)&s_options_freelook_box);
Menu_AddItem(&s_options_menu, (void *)&s_options_crosshair_box);
Menu_AddItem(&s_options_menu, (void*)&s_options_pauseonfocus_box);
if (show_gamepad)
{