add debug control
This commit is contained in:
parent
690940a6c3
commit
3df81364d6
@ -28,6 +28,10 @@ run/main_scene="res://scenes/debug_level.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
DebugUi="*res://scenes/debug_ui/debug_ui.tscn"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1920
|
||||
@ -74,6 +78,11 @@ turn_right={
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
show_debug_ui={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
|
||||
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")
|
||||
@ -1,7 +1 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn())
|
||||
DebugDraw2D.set_text("FPS", Engine.get_frames_per_second())
|
||||
DebugDraw2D.set_text("delta", delta)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user