From 0655e0c94223a6b0838da4514e3e6c843053eeb0 Mon Sep 17 00:00:00 2001 From: Albion Date: Sat, 10 Dec 2022 13:37:44 +0100 Subject: [PATCH] Added fullscreen-button --- menu/MainMenu.gd | 9 +++++++++ menu/main_menu.tscn | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/menu/MainMenu.gd b/menu/MainMenu.gd index bbbd491..9867bb0 100644 --- a/menu/MainMenu.gd +++ b/menu/MainMenu.gd @@ -24,3 +24,12 @@ func _on_tutorial_pressed(): func _on_quit_pressed(): get_tree().quit() + + +func _on_full_screen_pressed(): + if DisplayServer.window_get_mode() != DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN: + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN) + else: + if DisplayServer.window_get_mode() != DisplayServer.WINDOW_MODE_WINDOWED: + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) + diff --git a/menu/main_menu.tscn b/menu/main_menu.tscn index 2cb814a..aa164f6 100644 --- a/menu/main_menu.tscn +++ b/menu/main_menu.tscn @@ -13,6 +13,7 @@ grow_vertical = 2 script = ExtResource("1_hyw8p") [node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -21,6 +22,7 @@ grow_vertical = 2 color = Color(0.513726, 0.403922, 0.27451, 1) [node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -66,8 +68,13 @@ offset_right = 72.0 offset_bottom = 156.0 text = "Quit" +[node name="FullScreen" type="Button" parent="VBoxContainer"] +layout_mode = 2 +text = "Fullscreen" + [connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"] [connection signal="pressed" from="VBoxContainer/Tutorial" to="." method="_on_tutorial_pressed"] [connection signal="pressed" from="VBoxContainer/Settings" to="." method="_on_settings_pressed"] [connection signal="value_changed" from="VBoxContainer/VolSlider" to="VBoxContainer/VolSlider" method="_on_value_changed"] [connection signal="pressed" from="VBoxContainer/Quit" to="." method="_on_quit_pressed"] +[connection signal="pressed" from="VBoxContainer/FullScreen" to="." method="_on_full_screen_pressed"]