Added FPS label

master
Martin Felis 2021-06-17 23:04:13 +02:00
parent 9baddac840
commit 083877e216
2 changed files with 33 additions and 1 deletions

15
scenes/FPSValue.gd Normal file
View File

@ -0,0 +1,15 @@
extends Label
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _process(delta):
text = str(Performance.get_monitor(Performance.TIME_FPS))

View File

@ -4,6 +4,7 @@
[ext_resource path="res://scenes/HexTile.gd" type="Script" id=2] [ext_resource path="res://scenes/HexTile.gd" type="Script" id=2]
[ext_resource path="res://assets/pirate.svg" type="Texture" id=3] [ext_resource path="res://assets/pirate.svg" type="Texture" id=3]
[ext_resource path="res://scenes/pirate.gd" type="Script" id=4] [ext_resource path="res://scenes/pirate.gd" type="Script" id=4]
[ext_resource path="res://scenes/FPSValue.gd" type="Script" id=4]
[node name="GameRoot" type="Node"] [node name="GameRoot" type="Node"]
@ -13,7 +14,7 @@ script = ExtResource( 1 )
[node name="Camera" type="Camera2D" parent="World"] [node name="Camera" type="Camera2D" parent="World"]
current = true current = true
[node name="HexTile" type="Node" parent="World"] [node name="HexGridDrawer" type="Node" parent="World"]
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="UI" type="CanvasLayer" parent="World"] [node name="UI" type="CanvasLayer" parent="World"]
@ -86,3 +87,19 @@ scale = Vector2( 0.45498, 0.45498 )
texture = ExtResource( 3 ) texture = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="World/PlayerChar"] [node name="CollisionShape2D" type="CollisionShape2D" parent="World/PlayerChar"]
[node name="VSeparator" type="VSeparator" parent="World/UI/TopContainer"]
margin_left = 321.0
margin_right = 325.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="FPSValue" type="Label" parent="World/UI/TopContainer"]
margin_left = 329.0
margin_top = 13.0
margin_right = 337.0
margin_bottom = 27.0
text = "0"
align = 2
script = ExtResource( 4 )