From 083877e2161a4836d738aa81c1db88bca87e6cce Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Thu, 17 Jun 2021 23:04:13 +0200 Subject: [PATCH] Added FPS label --- scenes/FPSValue.gd | 15 +++++++++++++++ scenes/Game.tscn | 19 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 scenes/FPSValue.gd diff --git a/scenes/FPSValue.gd b/scenes/FPSValue.gd new file mode 100644 index 0000000..1982b42 --- /dev/null +++ b/scenes/FPSValue.gd @@ -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)) + diff --git a/scenes/Game.tscn b/scenes/Game.tscn index 20033c6..0d433cd 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -4,6 +4,7 @@ [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://scenes/pirate.gd" type="Script" id=4] +[ext_resource path="res://scenes/FPSValue.gd" type="Script" id=4] [node name="GameRoot" type="Node"] @@ -13,7 +14,7 @@ script = ExtResource( 1 ) [node name="Camera" type="Camera2D" parent="World"] current = true -[node name="HexTile" type="Node" parent="World"] +[node name="HexGridDrawer" type="Node" parent="World"] script = ExtResource( 2 ) [node name="UI" type="CanvasLayer" parent="World"] @@ -86,3 +87,19 @@ scale = Vector2( 0.45498, 0.45498 ) texture = ExtResource( 3 ) [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 )