From cbc4c347e38a99b54e3adfcce33837b6fd39df5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veeti=20V=C3=A4is=C3=A4nen?= Date: Thu, 30 Nov 2023 17:17:14 +0200 Subject: [PATCH 1/2] Initial debug info menu --- scenes/gui/debug_performance_info.gd | 11 ++++++ scenes/gui/debug_performance_info.tscn | 53 ++++++++++++++++++++++++++ scenes/gui/gui.tscn | 13 ++++++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 scenes/gui/debug_performance_info.gd create mode 100644 scenes/gui/debug_performance_info.tscn diff --git a/scenes/gui/debug_performance_info.gd b/scenes/gui/debug_performance_info.gd new file mode 100644 index 0000000..0db8d98 --- /dev/null +++ b/scenes/gui/debug_performance_info.gd @@ -0,0 +1,11 @@ +extends Control + +@onready var fps_label = $Info/FPS +@onready var draw_calls_label = $Info/DrawCalls +@onready var objects_label = $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..4b1273b --- /dev/null +++ b/scenes/gui/debug_performance_info.tscn @@ -0,0 +1,53 @@ +[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="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -134.0 +offset_top = -43.0 +offset_right = -44.0 +offset_bottom = 43.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="FPS" type="Label" parent="Info"] +layout_mode = 2 +text = "FPS: " + +[node name="DrawCalls" type="Label" parent="Info"] +layout_mode = 2 +text = "Draw Calls: " + +[node name="Objects" type="Label" parent="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 From 3b8f5ca19268e04e3176da8157033ff8f690e165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veeti=20V=C3=A4is=C3=A4nen?= Date: Thu, 30 Nov 2023 18:48:53 +0200 Subject: [PATCH 2/2] Update debug menu sizing --- scenes/gui/debug_performance_info.gd | 6 +++--- scenes/gui/debug_performance_info.tscn | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/scenes/gui/debug_performance_info.gd b/scenes/gui/debug_performance_info.gd index 0db8d98..b483d15 100644 --- a/scenes/gui/debug_performance_info.gd +++ b/scenes/gui/debug_performance_info.gd @@ -1,8 +1,8 @@ extends Control -@onready var fps_label = $Info/FPS -@onready var draw_calls_label = $Info/DrawCalls -@onready var objects_label = $Info/Objects +@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: diff --git a/scenes/gui/debug_performance_info.tscn b/scenes/gui/debug_performance_info.tscn index 4b1273b..03d5468 100644 --- a/scenes/gui/debug_performance_info.tscn +++ b/scenes/gui/debug_performance_info.tscn @@ -26,28 +26,29 @@ offset_bottom = 59.0 grow_horizontal = 2 grow_vertical = 2 -[node name="Info" type="VBoxContainer" parent="."] +[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 = -134.0 +offset_left = -133.5 offset_top = -43.0 -offset_right = -44.0 +offset_right = 131.5 offset_bottom = 43.0 grow_horizontal = 2 grow_vertical = 2 -[node name="FPS" type="Label" parent="Info"] +[node name="FPS" type="Label" parent="Panel/Info"] layout_mode = 2 text = "FPS: " -[node name="DrawCalls" type="Label" parent="Info"] +[node name="DrawCalls" type="Label" parent="Panel/Info"] layout_mode = 2 text = "Draw Calls: " -[node name="Objects" type="Label" parent="Info"] +[node name="Objects" type="Label" parent="Panel/Info"] layout_mode = 2 text = "Objects: "