game: add fps overlay

This commit is contained in:
2025-08-14 22:32:07 +02:00
parent 3c90e6a26c
commit 40d09e5b46
5 changed files with 76 additions and 28 deletions

17
game/overlay_fps.gd Normal file
View File

@@ -0,0 +1,17 @@
extends CanvasLayer
@onready var text = $RichTextLabel
@onready var timer = $Timer
func _ready() -> void:
visible = false
func _on_timer_timeout() -> void:
text.clear()
text.add_text("FPS: %s" % Engine.get_frames_per_second())
func _on_visibility_changed() -> void:
if visible:
timer.start()
else:
timer.stop()