diff --git a/scenes/gui/debug_performance_info.gd b/scenes/gui/debug_performance_info.gd new file mode 100644 index 0000000..b483d15 --- /dev/null +++ b/scenes/gui/debug_performance_info.gd @@ -0,0 +1,11 @@ +extends Control + +@onready var fps_label = $Panel/Info/FPS +@onready var draw_calls_label = $Panel/Info/DrawCalls +@onready var objects_label = $Panel/Info/Objects + + +func _process(delta: float) -> void: + fps_label.text = "FPS: %3.0f" % Performance.get_monitor(Performance.TIME_FPS) + draw_calls_label.text = "Draw Calls: %4.0f" % Performance.get_monitor(Performance.RENDER_TOTAL_DRAW_CALLS_IN_FRAME) + objects_label.text = "Object Count: %5.0f" % Performance.get_monitor(Performance.RENDER_TOTAL_OBJECTS_IN_FRAME) diff --git a/scenes/gui/debug_performance_info.tscn b/scenes/gui/debug_performance_info.tscn new file mode 100644 index 0000000..03d5468 --- /dev/null +++ b/scenes/gui/debug_performance_info.tscn @@ -0,0 +1,54 @@ +[gd_scene load_steps=2 format=3 uid="uid://cjffhmkmq6hyd"] + +[ext_resource type="Script" path="res://scenes/gui/debug_performance_info.gd" id="1_l1sf1"] + +[node name="DebugPerformanceInfo" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 4 +script = ExtResource("1_l1sf1") + +[node name="Panel" type="Panel" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -148.5 +offset_top = -59.0 +offset_right = 148.5 +offset_bottom = 59.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Info" type="VBoxContainer" parent="Panel"] +custom_minimum_size = Vector2(265, 86) +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -133.5 +offset_top = -43.0 +offset_right = 131.5 +offset_bottom = 43.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="FPS" type="Label" parent="Panel/Info"] +layout_mode = 2 +text = "FPS: " + +[node name="DrawCalls" type="Label" parent="Panel/Info"] +layout_mode = 2 +text = "Draw Calls: " + +[node name="Objects" type="Label" parent="Panel/Info"] +layout_mode = 2 +text = "Objects: " diff --git a/scenes/gui/gui.tscn b/scenes/gui/gui.tscn index 0b5c9ad..48e4f48 100644 --- a/scenes/gui/gui.tscn +++ b/scenes/gui/gui.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=6 format=3 uid="uid://dj3nxdbc2e1wv"] +[gd_scene load_steps=7 format=3 uid="uid://dj3nxdbc2e1wv"] [ext_resource type="Script" path="res://scenes/gui/gui.gd" id="3"] [ext_resource type="PackedScene" uid="uid://dbhema4vhnlcq" path="res://scenes/gui/input_app.tscn" id="4"] [ext_resource type="PackedScene" uid="uid://p18ehxphra4" path="res://scenes/gui/tire_data_app/tire_data_container.tscn" id="4_kkw3q"] [ext_resource type="PackedScene" uid="uid://d3u6g8p68o0bb" path="res://scenes/gui/tire_info_app.tscn" id="5"] [ext_resource type="PackedScene" uid="uid://cj0k2rs60ffh3" path="res://scenes/gui/lap_time_app.tscn" id="5_mnn8s"] +[ext_resource type="PackedScene" uid="uid://cjffhmkmq6hyd" path="res://scenes/gui/debug_performance_info.tscn" id="6_h3vfn"] [node name="Gui" type="Control"] layout_mode = 3 @@ -79,3 +80,13 @@ grow_horizontal = 0 [node name="LapTimeApp" parent="." instance=ExtResource("5_mnn8s")] layout_mode = 1 + +[node name="DebugPerformanceInfo" parent="." instance=ExtResource("6_h3vfn")] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.0 +offset_top = 60.0 +offset_bottom = 60.0 +grow_vertical = 1