init
This commit is contained in:
commit
e45f121fb9
89 changed files with 336069 additions and 0 deletions
18
demo/scripts/fps_overlay.gd
Normal file
18
demo/scripts/fps_overlay.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
extends CanvasLayer
|
||||
|
||||
# Cheap FPS + stats overlay. Attach as a child of any scene.
|
||||
# The parent scene can call set_subtitle(text) to add a line below the FPS.
|
||||
|
||||
@onready var label: Label = $Label
|
||||
var _subtitle := ""
|
||||
|
||||
func set_subtitle(text: String) -> void:
|
||||
_subtitle = text
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var fps := Engine.get_frames_per_second()
|
||||
var frame_ms := 0.0 if fps <= 0 else 1000.0 / fps
|
||||
var txt := "FPS: %d %.2f ms" % [fps, frame_ms]
|
||||
if _subtitle != "":
|
||||
txt += "\n" + _subtitle
|
||||
label.text = txt
|
||||
Loading…
Add table
Add a link
Reference in a new issue