From 6f79709af556e5e7b62d1cae88e0e78de37a6ce6 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Sun, 6 Jun 2021 19:02:30 +0200 Subject: [PATCH] add exit button --- .../addons/openvr_overlay/overlay_init.gd | 2 +- ovr-utils/overlay_scripts/main_menu.gd | 8 +++++ ovr-utils/styles/menu.theme | Bin 921 -> 924 bytes ovr-utils/ui/MainOverlay.tscn | 34 ++++++++++++++---- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/ovr-utils/addons/openvr_overlay/overlay_init.gd b/ovr-utils/addons/openvr_overlay/overlay_init.gd index 284d7f7..358a644 100644 --- a/ovr-utils/addons/openvr_overlay/overlay_init.gd +++ b/ovr-utils/addons/openvr_overlay/overlay_init.gd @@ -11,7 +11,7 @@ var trackers = { } func _init() -> void: - OS.window_minimized = true +# OS.window_minimized = true ovr_config = preload("res://addons/godot-openvr/OpenVRConfig.gdns").new() ovr_config.set_application_type(2) # Set to OVERLAY MODE = 2, NORMAL MODE = 1 ovr_config.set_tracking_universe(1) # Set to SEATED MODE = 0, STANDING MODE = 1, RAW MODE = 2 diff --git a/ovr-utils/overlay_scripts/main_menu.gd b/ovr-utils/overlay_scripts/main_menu.gd index 26d9636..0dd56f1 100644 --- a/ovr-utils/overlay_scripts/main_menu.gd +++ b/ovr-utils/overlay_scripts/main_menu.gd @@ -31,3 +31,11 @@ func _on_ShowOverlays_toggled(state: bool) -> void: func _on_AddOverlay_toggled(state: bool) -> void: $MarginContainer/VSplitContainer/Control/AddMenu.visible = state + +func _on_QuitToggle_toggled(state: bool) -> void: + $MarginContainer/VSplitContainer/MainBar/QuitToggle/Quit.visible = state + + +func _on_Quit_pressed() -> void: + Settings.save_settings() + get_tree().quit() diff --git a/ovr-utils/styles/menu.theme b/ovr-utils/styles/menu.theme index ee47e54b8fa8ccf76ef73d15ce3c3373a495edeb..61f2e97da39d2aeb13a9c73b4ec2e72485334cbd 100644 GIT binary patch delta 587 zcmV-R0<`^^2b>2WQd2`i0ss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tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://overlay_scripts/main_menu.gd" type="Script" id=1] [ext_resource path="res://styles/menu.theme" type="Theme" id=2] @@ -7,6 +7,7 @@ [ext_resource path="res://icons/move.svg" type="Texture" id=5] [ext_resource path="res://icons/list.svg" type="Texture" id=6] [ext_resource path="res://ui/ListOverlayItem.tscn" type="PackedScene" id=7] +[ext_resource path="res://icons/close.svg" type="Texture" id=8] [node name="MainOverlay" type="Control"] anchor_right = 1.0 @@ -76,22 +77,43 @@ focus_mode = 0 toggle_mode = true icon = ExtResource( 6 ) -[node name="GrabMode" type="Button" parent="MarginContainer/VSplitContainer/MainBar"] +[node name="AddOverlay" type="Button" parent="MarginContainer/VSplitContainer/MainBar"] margin_left = 180.0 margin_right = 356.0 margin_bottom = 191.0 focus_mode = 0 toggle_mode = true -icon = ExtResource( 5 ) +icon = ExtResource( 4 ) -[node name="AddOverlay" type="Button" parent="MarginContainer/VSplitContainer/MainBar"] +[node name="GrabMode" type="Button" parent="MarginContainer/VSplitContainer/MainBar"] margin_left = 360.0 margin_right = 536.0 margin_bottom = 191.0 focus_mode = 0 toggle_mode = true -icon = ExtResource( 4 ) +icon = ExtResource( 5 ) + +[node name="QuitToggle" type="Button" parent="MarginContainer/VSplitContainer/MainBar"] +margin_left = 540.0 +margin_right = 716.0 +margin_bottom = 191.0 +toggle_mode = true +icon = ExtResource( 8 ) + +[node name="Quit" type="Button" parent="MarginContainer/VSplitContainer/MainBar/QuitToggle"] +visible = false +margin_left = -4.0 +margin_top = -199.0 +margin_right = 915.0 +margin_bottom = -8.0 +text = "Really quit?" +icon = ExtResource( 8 ) +__meta__ = { +"_edit_use_anchors_": false +} [connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/ShowOverlays" to="." method="_on_ShowOverlays_toggled"] -[connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/GrabMode" to="." method="_on_GrabMode_toggled"] [connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/AddOverlay" to="." method="_on_AddOverlay_toggled"] +[connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/GrabMode" to="." method="_on_GrabMode_toggled"] +[connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/QuitToggle" to="." method="_on_QuitToggle_toggled"] +[connection signal="pressed" from="MarginContainer/VSplitContainer/MainBar/QuitToggle/Quit" to="." method="_on_Quit_pressed"]