Upload files to 'scenes/assets/fps_counter'
This commit is contained in:
parent
91c0ad760f
commit
eb5b8ef4a0
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/assets/fps_counter/fps_counter.gd" type="Script" id=1]
|
||||
|
||||
|
||||
|
||||
|
||||
[node name="FPS_Counter" type="Label"]
|
||||
margin_right = 100.0
|
||||
margin_bottom = 22.0
|
||||
custom_colors/font_color = Color( 0, 1, 0.101961, 1 )
|
||||
text = "FPS:"
|
||||
valign = 1
|
||||
script = ExtResource( 1 )
|
|
@ -0,0 +1,22 @@
|
|||
extends Label
|
||||
|
||||
##################################################
|
||||
|
||||
export var enabled := true
|
||||
|
||||
##################################################
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if enabled:
|
||||
var frames: float = Engine.get_frames_per_second()
|
||||
text = "FPS: "
|
||||
text += str(frames)
|
||||
|
||||
if frames >= 55:
|
||||
add_color_override("font_color", Color(0, 1, 0.1, 1))
|
||||
elif frames <= 25:
|
||||
add_color_override("font_color", Color(1, 0, 0, 1))
|
||||
else:
|
||||
add_color_override("font_color", Color(1, 1, 0, 1))
|
||||
else:
|
||||
text = ""
|
Reference in New Issue