Allow disabling the in-stream window from the stream scene
This commit is contained in:
@@ -445,18 +445,44 @@ void settings_streaming(const settings_context & ctx)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool disable_instream_gui = false;
|
||||||
|
bool disable_instream_gui_popup_open = ImGui::IsPopupOpen("confirm disable in stream gui");
|
||||||
list.push_back({
|
list.push_back({
|
||||||
.id = "##stream_gui",
|
.id = "##stream_gui",
|
||||||
.label = _C("setting name", "In-stream window"),
|
.label = _C("setting name", "In-stream window"),
|
||||||
.description = _("Enables the configuration window to be shown while the game is streaming. If enabled, the window is activated by pressing both thumbsticks."),
|
.description = _("Enables the configuration window to be shown while the game is streaming. If enabled, the window is activated by pressing both thumbsticks."),
|
||||||
.ui = ui_kind::toggle,
|
.ui = ui_kind::toggle,
|
||||||
.get_bool = [&config] { return config.enable_stream_gui; },
|
.get_bool = [&config, &disable_instream_gui_popup_open] { return config.enable_stream_gui and not disable_instream_gui_popup_open; },
|
||||||
.set_bool = [&config](bool v) { config.enable_stream_gui = v; config.save(); },
|
.set_bool = [&ctx, &config, &disable_instream_gui](bool v) {
|
||||||
|
if (ctx.in_game and not v)
|
||||||
|
{
|
||||||
|
disable_instream_gui = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config.enable_stream_gui = v;
|
||||||
|
config.save();
|
||||||
|
} },
|
||||||
.default_bool = true,
|
.default_bool = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
ui::page_header(_cS("page header title", "Streaming"), _cS("page header subtitle", "How video is encoded and sent to the headset."));
|
ui::page_header(_cS("page header title", "Streaming"), _cS("page header subtitle", "How video is encoded and sent to the headset."));
|
||||||
render_settings(ctx, "##streaming", list);
|
render_settings(ctx, "##streaming", list);
|
||||||
|
|
||||||
|
if (disable_instream_gui)
|
||||||
|
ImGui::OpenPopup("confirm disable in stream gui");
|
||||||
|
|
||||||
|
if (wivrn::ui::confirm_modal(
|
||||||
|
"confirm disable in stream gui",
|
||||||
|
_C("confirmation messagebox title", "Disable in-stream window"),
|
||||||
|
_C("confirmation message", "Do you really want to disable the in-stream window?\nYou will not be able to re-open it with the thumbsticks."),
|
||||||
|
_("Yes"),
|
||||||
|
_("No"),
|
||||||
|
true) == 1)
|
||||||
|
{
|
||||||
|
config.enable_stream_gui = false;
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_post_processing(const settings_context & ctx)
|
void settings_post_processing(const settings_context & ctx)
|
||||||
|
|||||||
@@ -558,11 +558,8 @@ void scenes::stream::on_focused()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (application::get_config().enable_stream_gui)
|
plots_toggle_1 = get_action("plots_toggle_1").first;
|
||||||
{
|
plots_toggle_2 = get_action("plots_toggle_2").first;
|
||||||
plots_toggle_1 = get_action("plots_toggle_1").first;
|
|
||||||
plots_toggle_2 = get_action("plots_toggle_2").first;
|
|
||||||
}
|
|
||||||
recenter_left = get_action("recenter_left").first;
|
recenter_left = get_action("recenter_left").first;
|
||||||
recenter_right = get_action("recenter_right").first;
|
recenter_right = get_action("recenter_right").first;
|
||||||
gui_distance_left = get_action("gui_distance_left").first;
|
gui_distance_left = get_action("gui_distance_left").first;
|
||||||
@@ -1174,7 +1171,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
|||||||
|
|
||||||
read_actions();
|
read_actions();
|
||||||
|
|
||||||
if (plots_toggle_1 and plots_toggle_2)
|
if (application::get_config().enable_stream_gui)
|
||||||
{
|
{
|
||||||
XrActionStateGetInfo get_info{
|
XrActionStateGetInfo get_info{
|
||||||
.type = XR_TYPE_ACTION_STATE_GET_INFO,
|
.type = XR_TYPE_ACTION_STATE_GET_INFO,
|
||||||
|
|||||||
Reference in New Issue
Block a user