game: add fps overlay
This commit is contained in:
17
game/overlay_fps.gd
Normal file
17
game/overlay_fps.gd
Normal 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()
|
Reference in New Issue
Block a user