add debug control
This commit is contained in:
13
scenes/debug_ui/debug_ui.gd
Normal file
13
scenes/debug_ui/debug_ui.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends Control
|
||||
|
||||
@export var show_debug_ui: bool = true
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("show_debug_ui"):
|
||||
show_debug_ui = !show_debug_ui
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if show_debug_ui:
|
||||
DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn())
|
||||
DebugDraw2D.set_text("FPS", Engine.get_frames_per_second())
|
||||
DebugDraw2D.set_text("delta", delta)
|
||||
12
scenes/debug_ui/debug_ui.tscn
Normal file
12
scenes/debug_ui/debug_ui.tscn
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://clcnavxmm7eae"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/debug_ui/debug_ui.gd" id="1_24u3s"]
|
||||
|
||||
[node name="DebugUi" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_24u3s")
|
||||
Reference in New Issue
Block a user