summaryrefslogtreecommitdiffstats
path: root/debug_info.gd
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-11-28 20:29:33 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-11-28 20:34:30 +0200
commitc575f0dc9a8c9c07ed8e8be62592072552ec9386 (patch)
treef58f6f65dee3b86f903bce655b0639c03fbac026 /debug_info.gd
parente07895be01b6bc7f813bbc392cc7852ffaf5e07b (diff)
Improve debug info
Diffstat (limited to 'debug_info.gd')
-rw-r--r--debug_info.gd21
1 files changed, 17 insertions, 4 deletions
diff --git a/debug_info.gd b/debug_info.gd
index 6a8c372..af11e24 100644
--- a/debug_info.gd
+++ b/debug_info.gd
@@ -1,10 +1,23 @@
class_name DebugInfo
extends CanvasLayer
-var player_state: PlayerState
+func _ready() -> void:
+ while true:
+ await get_tree().create_timer(0.05).timeout
+ _update.call_deferred()
-# Called every frame. 'delta' is the elapsed time since the previous frame.
-func _process(delta: float) -> void:
+func _update():
var text = ""
- if player_state: text += "%s\n" % player_state.to_string()
+
+ text += "FPS: %d\n" % Engine.get_frames_per_second()
+
+ var room: Node = get_tree().root.get_node_or_null("Top/ActiveRoom")
+ var player: Player
+ if room: player = room.find_child("Player")
+
+ if room:
+ text += "Room: %s\n" % room.scene_file_path
+ if player:
+ text += "%s\n" % player.state.to_string()
+
$Label.text = text