add exit button

This commit is contained in:
Crispy 2021-06-06 19:02:30 +02:00
parent 7dd5a544ab
commit 6f79709af5
4 changed files with 37 additions and 7 deletions

View file

@ -11,7 +11,7 @@ var trackers = {
} }
func _init() -> void: func _init() -> void:
OS.window_minimized = true # OS.window_minimized = true
ovr_config = preload("res://addons/godot-openvr/OpenVRConfig.gdns").new() 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_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 ovr_config.set_tracking_universe(1) # Set to SEATED MODE = 0, STANDING MODE = 1, RAW MODE = 2

View file

@ -31,3 +31,11 @@ func _on_ShowOverlays_toggled(state: bool) -> void:
func _on_AddOverlay_toggled(state: bool) -> void: func _on_AddOverlay_toggled(state: bool) -> void:
$MarginContainer/VSplitContainer/Control/AddMenu.visible = state $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()

Binary file not shown.

View file

@ -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://overlay_scripts/main_menu.gd" type="Script" id=1]
[ext_resource path="res://styles/menu.theme" type="Theme" id=2] [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/move.svg" type="Texture" id=5]
[ext_resource path="res://icons/list.svg" type="Texture" id=6] [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://ui/ListOverlayItem.tscn" type="PackedScene" id=7]
[ext_resource path="res://icons/close.svg" type="Texture" id=8]
[node name="MainOverlay" type="Control"] [node name="MainOverlay" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -76,22 +77,43 @@ focus_mode = 0
toggle_mode = true toggle_mode = true
icon = ExtResource( 6 ) 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_left = 180.0
margin_right = 356.0 margin_right = 356.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true 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_left = 360.0
margin_right = 536.0 margin_right = 536.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true 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/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/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"]