diff --git a/Scenes/GUI/DebugMenu.tscn b/Scenes/GUI/DebugMenu.tscn new file mode 100644 index 0000000..1f9ebe5 --- /dev/null +++ b/Scenes/GUI/DebugMenu.tscn @@ -0,0 +1,66 @@ +[gd_scene load_steps=2 format=3 uid="uid://fjveglbs1vfv"] + +[ext_resource type="Script" uid="uid://724u7h4bui7r" path="res://Scripts/DebugMenu.gd" id="1_gqrkn"] + +[node name="DebugMenu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_gqrkn") + +[node name="FPSLabel" type="Label" parent="."] +layout_mode = 0 +offset_left = 8.0 +offset_top = 8.0 +offset_right = 53.0 +offset_bottom = 40.0 +text = "FPS: 0" +vertical_alignment = 1 + +[node name="PositionLabel" type="Label" parent="."] +layout_mode = 0 +offset_left = 8.0 +offset_top = 44.0 +offset_right = 175.0 +offset_bottom = 76.0 +text = "X: 0.00, Y: 0.00, Z: 0.00" +vertical_alignment = 1 + +[node name="AngleLabel" type="Label" parent="."] +offset_left = 8.0 +offset_top = 80.0 +offset_right = 175.0 +offset_bottom = 112.0 +text = "Pitch: 0.00, Yaw: 0.00" +vertical_alignment = 1 + +[node name="VersionLabel" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -203.0 +offset_top = 8.0 +offset_right = -8.0 +offset_bottom = 40.0 +grow_horizontal = 0 +text = "Pneumatic Plaything v0.0" +horizontal_alignment = 2 +vertical_alignment = 1 + +[node name="PlatformLabel" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -203.0 +offset_top = 44.0 +offset_right = -8.0 +offset_bottom = 76.0 +grow_horizontal = 0 +text = "this is placeholder text!!!!!!!" +horizontal_alignment = 2 +vertical_alignment = 1 diff --git a/Scripts/DebugMenu.gd b/Scripts/DebugMenu.gd new file mode 100644 index 0000000..dbb8895 --- /dev/null +++ b/Scripts/DebugMenu.gd @@ -0,0 +1,13 @@ +extends Control + +func _ready() -> void: + $VersionLabel.text = "Pneumatic Plaything v%s" % ProjectSettings.get_setting("application/config/version") + $PlatformLabel.text = "%s %s %s" % [OS.get_name(), OS.get_version(), Engine.get_architecture_name()] + +func _process(_delta: float) -> void: + if (visible): + $FPSLabel.text = "FPS: %.0f" % Engine.get_frames_per_second() + var pos = get_node("../").position + var angle = get_node("../Camera").rotation_degrees + $PositionLabel.text = "X: %.2f, Y: %.2f, Z: %.2f" % [ pos.x, pos.y, pos.z ] + $AngleLabel.text = "Pitch: %.2f, Yaw: %.2f" % [ angle.x, angle.y ] diff --git a/Scripts/DebugMenu.gd.uid b/Scripts/DebugMenu.gd.uid new file mode 100644 index 0000000..65ca744 --- /dev/null +++ b/Scripts/DebugMenu.gd.uid @@ -0,0 +1 @@ +uid://724u7h4bui7r diff --git a/Scripts/Player/player.gd b/Scripts/Player/player.gd index 480febf..db98396 100644 --- a/Scripts/Player/player.gd +++ b/Scripts/Player/player.gd @@ -55,6 +55,8 @@ func _unhandled_input(event: InputEvent) -> void: $InGameMenu.visible = true $InGameMenu/Buttons/ReturnButton.grab_focus() pass + elif event.is_action_pressed(&"freeroam_debug_menu"): + $DebugMenu.visible = !$DebugMenu.visible func _physics_process(delta: float) -> void: if (interact): diff --git a/Scripts/Player/player.tscn b/Scripts/Player/player.tscn index a78e66d..963ba57 100644 --- a/Scripts/Player/player.tscn +++ b/Scripts/Player/player.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=3 uid="uid://cdk6hwb4hi2wc"] +[gd_scene load_steps=5 format=3 uid="uid://cdk6hwb4hi2wc"] [ext_resource type="Script" uid="uid://b0c02p6ckmpdq" path="res://Scripts/Player/player.gd" id="1_2f8j2"] [ext_resource type="PackedScene" uid="uid://cd67bfok34xhy" path="res://Scenes/GUI/InGameMenu.tscn" id="2_0s4r2"] +[ext_resource type="PackedScene" uid="uid://fjveglbs1vfv" path="res://Scenes/GUI/DebugMenu.tscn" id="3_ejydr"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_3rsb5"] radius = 0.3 @@ -27,5 +28,9 @@ spot_range = 1000.0 spot_angle = 30.0 spot_angle_attenuation = 0.25 +[node name="DebugMenu" parent="." instance=ExtResource("3_ejydr")] +visible = false +mouse_filter = 2 + [node name="InGameMenu" parent="." instance=ExtResource("2_0s4r2")] visible = false diff --git a/project.godot b/project.godot index 4f4cdf9..412de36 100644 --- a/project.godot +++ b/project.godot @@ -513,6 +513,11 @@ freeroam_open_curtains={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) ] } +freeroam_debug_menu={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194334,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} [rendering]