From 7fad76f76d2eb3e25dd1a380ae6aa7a1f0a99b2f Mon Sep 17 00:00:00 2001 From: "Telmo \"Trooper" Date: Wed, 23 Jun 2021 22:21:36 -0300 Subject: [PATCH] Added toggle fullscreen button to pause menu --- my-3d-squash-the-creeps/Main.tscn | 6 ++++++ my-3d-squash-the-creeps/Pause.gd | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/my-3d-squash-the-creeps/Main.tscn b/my-3d-squash-the-creeps/Main.tscn index 5604d373..3e48d01c 100644 --- a/my-3d-squash-the-creeps/Main.tscn +++ b/my-3d-squash-the-creeps/Main.tscn @@ -213,6 +213,11 @@ margin_right = 224.0 margin_bottom = 72.0 text = "Resume" +[node name="ToggleFullscreenButton" type="Button" parent="UserInterface/Pause/HBoxContainer"] +margin_right = 12.0 +margin_bottom = 37.0 +text = "Toggle Fullscreen" + [node name="ExitButton" type="Button" parent="UserInterface/Pause/HBoxContainer"] margin_top = 82.0 margin_right = 224.0 @@ -247,5 +252,6 @@ transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 3.5, [connection signal="hit" from="Player" to="." method="_on_Player_hit"] [connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"] [connection signal="pressed" from="UserInterface/Pause/HBoxContainer/ResumeButton" to="UserInterface/Pause" method="_on_ResumeButton_pressed"] +[connection signal="pressed" from="UserInterface/Pause/HBoxContainer/ToggleFullscreenButton" to="UserInterface/Pause" method="_on_ToggleFullscreenButton_pressed"] [connection signal="pressed" from="UserInterface/Pause/HBoxContainer/ExitButton" to="UserInterface/Pause" method="_on_ExitButton_pressed"] [connection signal="body_entered" from="Boundary" to="Boundary" method="_on_Boundary_body_entered"] diff --git a/my-3d-squash-the-creeps/Pause.gd b/my-3d-squash-the-creeps/Pause.gd index 9c9dcbd6..ed3f3da9 100644 --- a/my-3d-squash-the-creeps/Pause.gd +++ b/my-3d-squash-the-creeps/Pause.gd @@ -17,3 +17,7 @@ func _on_ResumeButton_pressed(): func _on_ExitButton_pressed(): get_tree().quit() + +func _on_ToggleFullscreenButton_pressed(): + OS.window_fullscreen = !OS.window_fullscreen + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)