aboutsummaryrefslogtreecommitdiff
path: root/client/gui
diff options
context:
space:
mode:
Diffstat (limited to 'client/gui')
-rw-r--r--client/gui/menus/game.gd6
-rw-r--r--client/gui/menus/game.tscn10
-rw-r--r--client/gui/overlays/debug.gd39
-rw-r--r--client/gui/overlays/debug.gd.uid1
-rw-r--r--client/gui/overlays/debug.tscn13
-rw-r--r--client/gui/overlays/overlays.tscn8
6 files changed, 60 insertions, 17 deletions
diff --git a/client/gui/menus/game.gd b/client/gui/menus/game.gd
index 97c8cc1d..71c2ceb7 100644
--- a/client/gui/menus/game.gd
+++ b/client/gui/menus/game.gd
@@ -55,12 +55,6 @@ func _menu_cover(state):
game.follow_camera.disable_input_menu = state
game.follow_camera.update_disable_input()
-func _process(_delta):
- if Settings.read("graphics.debug_info"):
- debug_label.show()
- debug_label.text = "%d FPS\nDriver: %s" % [Engine.get_frames_per_second(), ProjectSettings.get_setting("rendering/rendering_device/driver")]
- else: debug_label.hide()
-
func open_ingame_menu():
if popup != null: return
Sound.play_click()
diff --git a/client/gui/menus/game.tscn b/client/gui/menus/game.tscn
index cd6b0987..44efef21 100644
--- a/client/gui/menus/game.tscn
+++ b/client/gui/menus/game.tscn
@@ -18,13 +18,3 @@ auto_anim = false
[node name="Overlays" parent="." instance=ExtResource("3_eaud4")]
layout_mode = 1
-
-[node name="Debug" type="RichTextLabel" parent="."]
-visible = false
-layout_mode = 1
-anchors_preset = 15
-anchor_right = 1.0
-anchor_bottom = 1.0
-grow_horizontal = 2
-grow_vertical = 2
-mouse_filter = 2
diff --git a/client/gui/overlays/debug.gd b/client/gui/overlays/debug.gd
new file mode 100644
index 00000000..bb978ad8
--- /dev/null
+++ b/client/gui/overlays/debug.gd
@@ -0,0 +1,39 @@
+# Hurry Curry! - a game about cooking
+# Copyright (C) 2025 Hurry Curry! contributors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends RichTextLabel
+
+func _ready():
+ Settings.hook_changed_init("graphics.debug_info", false, func (v):
+ visible = v
+ RenderingServer.viewport_set_measure_render_time(get_viewport().get_viewport_rid(), visible)
+ )
+
+func _process(_delta):
+ if not visible: return
+ var t = ""
+ t += "Renderer: %s (%s)\n" % [RenderingServer.get_current_rendering_driver_name(), RenderingServer.get_video_adapter_name()]
+ t += "Timing: %.01fms CPU; %.01fms GPU\n" % [
+ RenderingServer.viewport_get_measured_render_time_cpu(get_viewport().get_viewport_rid()),
+ RenderingServer.viewport_get_measured_render_time_gpu(get_viewport().get_viewport_rid())
+ ]
+ t += "Resolution: %dx%d\n" % [get_tree().root.size.x, get_tree().root.size.y]
+ t += "FPS: %d\n" % Engine.get_frames_per_second()
+ t += "Node count: %d\n" % get_tree().get_node_count()
+ text = t
+
+func _input(_event):
+ if Input.is_action_just_pressed("toggle_debug"):
+ Settings.write("graphics.debug_info", not Settings.read("graphics.debug_info"))
diff --git a/client/gui/overlays/debug.gd.uid b/client/gui/overlays/debug.gd.uid
new file mode 100644
index 00000000..318ab745
--- /dev/null
+++ b/client/gui/overlays/debug.gd.uid
@@ -0,0 +1 @@
+uid://bpmdfuqjtwf5v
diff --git a/client/gui/overlays/debug.tscn b/client/gui/overlays/debug.tscn
new file mode 100644
index 00000000..3de36e94
--- /dev/null
+++ b/client/gui/overlays/debug.tscn
@@ -0,0 +1,13 @@
+[gd_scene load_steps=2 format=3 uid="uid://3lytexnfrub6"]
+
+[ext_resource type="Script" uid="uid://bpmdfuqjtwf5v" path="res://gui/overlays/debug.gd" id="1_62otr"]
+
+[node name="Debug" type="RichTextLabel"]
+visible = false
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+script = ExtResource("1_62otr")
diff --git a/client/gui/overlays/overlays.tscn b/client/gui/overlays/overlays.tscn
index 67f1082f..cf1df985 100644
--- a/client/gui/overlays/overlays.tscn
+++ b/client/gui/overlays/overlays.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=8 format=3 uid="uid://cr26jennm5c0c"]
+[gd_scene load_steps=9 format=3 uid="uid://cr26jennm5c0c"]
[ext_resource type="Script" uid="uid://bkvtm1jlme6jf" path="res://gui/overlays/overlays.gd" id="1_dcvak"]
[ext_resource type="PackedScene" uid="uid://xcxbmynn8mhi" path="res://gui/overlays/chat.tscn" id="1_n4uhr"]
@@ -7,6 +7,7 @@
[ext_resource type="PackedScene" uid="uid://bc50la65ntifb" path="res://gui/overlays/lobby/lobby.tscn" id="4_jwd7s"]
[ext_resource type="PackedScene" uid="uid://c7pykhpdhgs64" path="res://gui/overlays/announce_title.tscn" id="5_whygm"]
[ext_resource type="PackedScene" uid="uid://b21nrnkygiyjt" path="res://gui/overlays/popup_message/popup_message.tscn" id="7_jwd7s"]
+[ext_resource type="PackedScene" uid="uid://3lytexnfrub6" path="res://gui/overlays/debug.tscn" id="8_8ouu3"]
[node name="Overlays" type="Control"]
layout_mode = 3
@@ -39,3 +40,8 @@ grow_vertical = 2
[node name="PopupMessage" parent="." instance=ExtResource("7_jwd7s")]
layout_mode = 1
+
+[node name="Debug" parent="." instance=ExtResource("8_8ouu3")]
+layout_mode = 1
+text = "Text of the
+debug overlay"