diff --git a/scenes/debugger/Debugger.tscn b/scenes/debugger/Debugger.tscn new file mode 100644 index 0000000..18142e7 --- /dev/null +++ b/scenes/debugger/Debugger.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://scenes/debugger/StateDebugger.cs" type="Script" id=1] +[ext_resource path="res://scenes/debugger/FPS.cs" type="Script" id=2] + +[node name="Debugger" type="CanvasLayer"] + +[node name="Control" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="Control"] + +[node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer"] +margin_right = 40.0 +margin_bottom = 14.0 + +[node name="Label" type="Label" parent="Control/VBoxContainer/HBoxContainer"] +margin_right = 26.0 +margin_bottom = 14.0 +text = "FPS:" + +[node name="Label2" type="Label" parent="Control/VBoxContainer/HBoxContainer"] +margin_left = 30.0 +margin_right = 30.0 +margin_bottom = 14.0 +script = ExtResource( 2 ) + +[node name="HBoxContainer2" type="HBoxContainer" parent="Control/VBoxContainer"] +margin_top = 18.0 +margin_right = 40.0 +margin_bottom = 32.0 + +[node name="Label" type="Label" parent="Control/VBoxContainer/HBoxContainer2"] +margin_right = 36.0 +margin_bottom = 14.0 +text = "State:" + +[node name="Label2" type="Label" parent="Control/VBoxContainer/HBoxContainer2"] +margin_left = 40.0 +margin_right = 40.0 +margin_bottom = 14.0 +script = ExtResource( 1 ) diff --git a/scenes/debugger/FPS.cs b/scenes/debugger/FPS.cs new file mode 100644 index 0000000..b3aafad --- /dev/null +++ b/scenes/debugger/FPS.cs @@ -0,0 +1,15 @@ +using Godot; +using System; + +public class FPS : Label +{ + public override void _Ready() + { + + } + + public override void _Process(float delta) + { + Text = Engine.GetFramesPerSecond().ToString(); + } +} diff --git a/scenes/debugger/StateDebugger.cs b/scenes/debugger/StateDebugger.cs new file mode 100644 index 0000000..ba7f515 --- /dev/null +++ b/scenes/debugger/StateDebugger.cs @@ -0,0 +1,18 @@ +using Godot; +using System; + +public class StateDebugger : Label +{ + private Event _event; + + public override void _Ready() + { + _event = GetNode("/root/Event"); + _event.Connect("DebugState", this, "OnDebugState"); + } + + private void OnDebugState(string state) + { + Text = state; + } +}