stuff
This commit is contained in:
@@ -34,10 +34,10 @@ const GRAPH_MAX_FRAMETIME = 1.0 / GRAPH_MAX_FPS
|
||||
|
||||
## Debug menu display style.
|
||||
enum Style {
|
||||
HIDDEN, ## Debug menu is hidden.
|
||||
VISIBLE_COMPACT, ## Debug menu is visible, with only the FPS, FPS cap (if any) and time taken to render the last frame.
|
||||
VISIBLE_DETAILED, ## Debug menu is visible with full information, including graphs.
|
||||
MAX, ## Represents the size of the Style enum.
|
||||
HIDDEN, ## Debug menu is hidden.
|
||||
VISIBLE_COMPACT, ## Debug menu is visible, with only the FPS, FPS cap (if any) and time taken to render the last frame.
|
||||
VISIBLE_DETAILED, ## Debug menu is visible with full information, including graphs.
|
||||
MAX, ## Represents the size of the Style enum.
|
||||
}
|
||||
|
||||
## The style to use when drawing the debug menu.
|
||||
@@ -70,7 +70,7 @@ var sum_func := func avg(accum: float, number: float) -> float: return accum + n
|
||||
var frame_history_total: Array[float] = []
|
||||
var frame_history_cpu: Array[float] = []
|
||||
var frame_history_gpu: Array[float] = []
|
||||
var fps_history: Array[float] = [] # Only used for graphs.
|
||||
var fps_history: Array[float] = [] # Only used for graphs.
|
||||
|
||||
var frametime_avg := GRAPH_MIN_FRAMETIME
|
||||
var frametime_cpu_avg := GRAPH_MAX_FRAMETIME
|
||||
@@ -106,10 +106,10 @@ func _ready() -> void:
|
||||
# (red = 10 FPS, yellow = 60 FPS, green = 110 FPS, cyan = 160 FPS).
|
||||
# This makes the color gradient non-linear.
|
||||
# Colors are taken from <https://tailwindcolor.com/>.
|
||||
frame_time_gradient.set_color(0, Color8(239, 68, 68)) # red-500
|
||||
frame_time_gradient.set_color(1, Color8(56, 189, 248)) # light-blue-400
|
||||
frame_time_gradient.add_point(0.3333, Color8(250, 204, 21)) # yellow-400
|
||||
frame_time_gradient.add_point(0.6667, Color8(128, 226, 95)) # 50-50 mix of lime-400 and green-400
|
||||
frame_time_gradient.set_color(0, Color(239, 68, 68)) # red-500
|
||||
frame_time_gradient.set_color(1, Color(56, 189, 248)) # light-blue-400
|
||||
frame_time_gradient.add_point(0.3333, Color(250, 204, 21)) # yellow-400
|
||||
frame_time_gradient.add_point(0.6667, Color(128, 226, 95)) # 50-50 mix of lime-400 and green-400
|
||||
|
||||
get_viewport().size_changed.connect(update_settings_label)
|
||||
|
||||
@@ -274,8 +274,8 @@ func update_information_label() -> void:
|
||||
|
||||
information.text = (
|
||||
"%s, %d threads\n" % [OS.get_processor_name().replace("(R)", "").replace("(TM)", ""), OS.get_processor_count()]
|
||||
+ "%s %s (%s %s), %s %s\n" % [OS.get_name(), "64-bit" if OS.has_feature("64") else "32-bit", release_string, "double" if OS.has_feature("double") else "single", graphics_api_string, RenderingServer.get_video_adapter_api_version()]
|
||||
+ "%s, %s" % [adapter_string, driver_info_string]
|
||||
+"%s %s (%s %s), %s %s\n" % [OS.get_name(), "64-bit" if OS.has_feature("64") else "32-bit", release_string, "double" if OS.has_feature("double") else "single", graphics_api_string, RenderingServer.get_video_adapter_api_version()]
|
||||
+"%s, %s" % [adapter_string, driver_info_string]
|
||||
)
|
||||
|
||||
|
||||
|
||||
1
addons/debug_menu/debug_menu.gd.uid
Normal file
1
addons/debug_menu/debug_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://uy4ruqo71tqe
|
||||
@@ -1,7 +1,20 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cggqb75a8w8r"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cggqb75a8w8r"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/debug_menu/debug_menu.gd" id="1_p440y"]
|
||||
|
||||
[sub_resource type="SystemFont" id="SystemFont_f56mb"]
|
||||
font_names = PackedStringArray("Sans-Serif", "", "", "", "", "", "", "", "", "")
|
||||
|
||||
[sub_resource type="Theme" id="Theme_qdnc2"]
|
||||
default_font = SubResource("SystemFont_f56mb")
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6qqxv"]
|
||||
bg_color = Color(0, 0, 0, 0.498039)
|
||||
expand_margin_left = 8.0
|
||||
expand_margin_top = 8.0
|
||||
expand_margin_right = 8.0
|
||||
expand_margin_bottom = 8.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ki0n8"]
|
||||
bg_color = Color(0, 0, 0, 0.25098)
|
||||
|
||||
@@ -9,20 +22,19 @@ bg_color = Color(0, 0, 0, 0.25098)
|
||||
process_mode = 3
|
||||
layer = 128
|
||||
|
||||
[node name="DebugMenu" type="Control" parent="." node_paths=PackedStringArray("fps", "frame_time", "frame_number", "frame_history_total_avg", "frame_history_total_min", "frame_history_total_max", "frame_history_total_last", "frame_history_cpu_avg", "frame_history_cpu_min", "frame_history_cpu_max", "frame_history_cpu_last", "frame_history_gpu_avg", "frame_history_gpu_min", "frame_history_gpu_max", "frame_history_gpu_last", "fps_graph", "total_graph", "cpu_graph", "gpu_graph", "information", "settings")]
|
||||
[node name="DebugMenu" type="PanelContainer" parent="." node_paths=PackedStringArray("fps", "frame_time", "frame_number", "frame_history_total_avg", "frame_history_total_min", "frame_history_total_max", "frame_history_total_last", "frame_history_cpu_avg", "frame_history_cpu_min", "frame_history_cpu_max", "frame_history_cpu_last", "frame_history_gpu_avg", "frame_history_gpu_min", "frame_history_gpu_max", "frame_history_gpu_last", "fps_graph", "total_graph", "cpu_graph", "gpu_graph", "information", "settings")]
|
||||
custom_minimum_size = Vector2(400, 400)
|
||||
layout_mode = 3
|
||||
anchors_preset = 1
|
||||
anchors_preset = 11
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -416.0
|
||||
offset_top = 8.0
|
||||
offset_right = -16.0
|
||||
offset_bottom = 408.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -277.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 4
|
||||
mouse_filter = 2
|
||||
theme = SubResource("Theme_qdnc2")
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_6qqxv")
|
||||
script = ExtResource("1_p440y")
|
||||
fps = NodePath("VBoxContainer/FPS")
|
||||
frame_time = NodePath("VBoxContainer/FrameTime")
|
||||
@@ -47,13 +59,7 @@ information = NodePath("VBoxContainer/Information")
|
||||
settings = NodePath("VBoxContainer/Settings")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="DebugMenu"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -300.0
|
||||
offset_bottom = 374.0
|
||||
grow_horizontal = 0
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
@@ -61,8 +67,8 @@ theme_override_constants/separation = 0
|
||||
modulate = Color(0, 1, 0, 1)
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 5
|
||||
theme_override_constants/line_spacing = 0
|
||||
theme_override_constants/outline_size = 5
|
||||
theme_override_font_sizes/font_size = 18
|
||||
text = "60 FPS"
|
||||
horizontal_alignment = 2
|
||||
|
||||
1
addons/debug_menu/plugin.gd.uid
Normal file
1
addons/debug_menu/plugin.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c15ljqrjuqgvh
|
||||
Reference in New Issue
Block a user