diff --git a/share/config.c b/share/config.c index ea6507277..25fc4b52e 100644 --- a/share/config.c +++ b/share/config.c @@ -46,6 +46,7 @@ int CONFIG_MOUSE_SENSE; int CONFIG_MOUSE_RESPONSE; int CONFIG_MOUSE_INVERT; int CONFIG_VSYNC; +int CONFIG_TRANSITIONS; int CONFIG_HMD; int CONFIG_HIGHDPI; int CONFIG_MOUSE_CAMERA_1; @@ -158,6 +159,7 @@ static struct { &CONFIG_MOUSE_RESPONSE, "mouse_response", 50 }, { &CONFIG_MOUSE_INVERT, "mouse_invert", 0 }, { &CONFIG_VSYNC, "vsync", 1 }, + { &CONFIG_TRANSITIONS, "ui_transitions", 1 }, { &CONFIG_HMD, "hmd", 0 }, { &CONFIG_HIGHDPI, "highdpi", 1 }, diff --git a/share/config.h b/share/config.h index 8f2e241a9..f5d9ca23c 100644 --- a/share/config.h +++ b/share/config.h @@ -38,6 +38,7 @@ extern int CONFIG_MOUSE_RESPONSE; extern int CONFIG_MOUSE_INVERT; extern int CONFIG_VSYNC; extern int CONFIG_HMD; +extern int CONFIG_TRANSITIONS; extern int CONFIG_HIGHDPI; extern int CONFIG_MOUSE_CAMERA_1; extern int CONFIG_MOUSE_CAMERA_2; @@ -153,4 +154,4 @@ int config_screenshot(void); /*---------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif diff --git a/share/gui.c b/share/gui.c index 8f686e860..e19c21d74 100644 --- a/share/gui.c +++ b/share/gui.c @@ -2318,10 +2318,18 @@ void gui_timer(int id, float dt) widget[id].slide_time += dt; - alpha = (widget[id].slide_time - widget[id].slide_delay) / widget[id].slide_dur; - alpha = CLAMP(0.0f, alpha, 1.0f); + if (config_get_d(CONFIG_TRANSITIONS) == 0) + { + alpha = 1.0f; + at_end = 1; + } + else + { + alpha = (widget[id].slide_time - widget[id].slide_delay) / widget[id].slide_dur; + alpha = CLAMP(0.0f, alpha, 1.0f); - at_end = (alpha >= 1.0f); + at_end = (alpha >= 1.0f); + } if (widget[id].slide_flags & GUI_BACKWARD) { diff --git a/share/st_common.c b/share/st_common.c index 246577ece..bfcc73bfc 100644 --- a/share/st_common.c +++ b/share/st_common.c @@ -252,7 +252,8 @@ enum VIDEO_SHADOW, VIDEO_VSYNC, VIDEO_HMD, - VIDEO_MULTISAMPLE + VIDEO_MULTISAMPLE, + VIDEO_TRANSITIONS }; static struct state *video_back; @@ -326,6 +327,12 @@ static int video_action(int tok, int val) r = video_mode(f, w, h); goto_state(&st_video); break; + case VIDEO_TRANSITIONS: + goto_state(&st_null); + config_set_d(CONFIG_TRANSITIONS, val); + r = video_mode(f, w, h); + goto_state(&st_video); + break; } return r; @@ -400,7 +407,13 @@ static int video_gui(void) conf_toggle(id, _("Shadow"), VIDEO_SHADOW, config_get_d(CONFIG_SHADOW), _("On"), 1, _("Off"), 0); + gui_space(id); + + conf_toggle(id, _("UI Transitions"), VIDEO_TRANSITIONS, + config_get_d(CONFIG_TRANSITIONS), _("On"), 1, _("Off"), 0); + gui_layout(id, 0, 0); + } return id;