diff --git a/UI/Debug/DebugUI.tscn b/UI/Debug/DebugUI.tscn index c1b4019..275abf1 100644 --- a/UI/Debug/DebugUI.tscn +++ b/UI/Debug/DebugUI.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=3 uid="uid://be8bc4eivsg4s"] +[gd_scene load_steps=5 format=3 uid="uid://be8bc4eivsg4s"] [ext_resource type="Script" path="res://Debug/DebugConsole.cs" id="1_3fw5a"] [ext_resource type="Script" path="res://UI/Debug/DebugUI.cs" id="1_b7eq2"] [ext_resource type="Script" path="res://Debug/Entry.cs" id="2_kdlsh"] +[ext_resource type="Script" path="res://UI/Debug/FramerateCounter.cs" id="4_e5jgp"] [node name="DebugUI" type="CanvasLayer"] process_mode = 3 @@ -56,3 +57,19 @@ code_completion_enabled = true auto_brace_completion_enabled = true auto_brace_completion_highlight_matching = true script = ExtResource("2_kdlsh") + +[node name="Control" type="ColorRect" parent="."] +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +grow_horizontal = 0 +color = Color(0, 0, 0, 0.501961) + +[node name="Label" type="Label" parent="Control"] +layout_direction = 3 +layout_mode = 2 +offset_right = 41.0 +offset_bottom = 23.0 +text = "0 FPS" +horizontal_alignment = 2 +script = ExtResource("4_e5jgp") diff --git a/UI/Debug/FramerateCounter.cs b/UI/Debug/FramerateCounter.cs new file mode 100644 index 0000000..853dbc8 --- /dev/null +++ b/UI/Debug/FramerateCounter.cs @@ -0,0 +1,12 @@ +using System; +using Godot; + +namespace SupaLidlGame.UI; + +public partial class FramerateCounter : Label +{ + public override void _Process(double delta) + { + Text = $"{Math.Round(Engine.GetFramesPerSecond())} FPS"; + } +}