move debugger scene from global to local
This commit is contained in:
@@ -28,7 +28,6 @@ config/icon="res://icon.svg"
|
||||
|
||||
Settings="*res://scripts/globals/settings.gd"
|
||||
Inputer="*res://scripts/globals/inputer.gd"
|
||||
Debugger="*res://scenes/debugger.tscn"
|
||||
Cursor="*res://scenes/ui/cursor.tscn"
|
||||
Music="*res://scripts/audio/music.gd"
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=24 format=3 uid="uid://c0buetf2h266d"]
|
||||
[gd_scene load_steps=25 format=3 uid="uid://c0buetf2h266d"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://btpy4dp5lb8il" path="res://resources/materials/test_triplanar.tres" id="1_ixaua"]
|
||||
[ext_resource type="PackedScene" uid="uid://b73y71y3efmv" path="res://scenes/player.tscn" id="2_f4ehn"]
|
||||
[ext_resource type="PackedScene" uid="uid://bq8pflbvlf8q7" path="res://scenes/main_camera.tscn" id="3_74lek"]
|
||||
[ext_resource type="PackedScene" uid="uid://cksoaevb5sloo" path="res://scenes/enemies/projectile_spawner.tscn" id="4_84n74"]
|
||||
[ext_resource type="PackedScene" uid="uid://cejn8wfgw14xs" path="res://scenes/projectiles/projectile.tscn" id="5_j5jx5"]
|
||||
[ext_resource type="PackedScene" uid="uid://xph4078n1fyq" path="res://scenes/debugger.tscn" id="6_lpvoh"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_wctar"]
|
||||
|
||||
@@ -135,3 +136,5 @@ libraries = {
|
||||
[node name="Projectile" parent="." instance=ExtResource("5_j5jx5")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.1254, 1.08522, -3.37655)
|
||||
script = null
|
||||
|
||||
[node name="Debugger" parent="." instance=ExtResource("6_lpvoh")]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
class_name Debugger
|
||||
extends CanvasLayer
|
||||
## Handles displaying debug info.
|
||||
|
||||
@@ -10,6 +11,9 @@ const MARKER_RADIUS: float = 0.2
|
||||
const CIRCLE_RADIUS: float = 3
|
||||
const DEFAULT_COLOR: Color = Color.RED
|
||||
|
||||
static var mode: Mode = Mode.PERFORMANCE
|
||||
static var instance: Debugger
|
||||
|
||||
@export_group("References")
|
||||
@export var _control: Control
|
||||
@export var _label1: RichTextLabel
|
||||
@@ -17,8 +21,6 @@ const DEFAULT_COLOR: Color = Color.RED
|
||||
@export var _label3: RichTextLabel
|
||||
@export var _label4: RichTextLabel
|
||||
|
||||
var mode: Mode = Mode.PERFORMANCE
|
||||
|
||||
var _vectors_to_draw: Dictionary = {}
|
||||
var _lines_to_draw: Dictionary = {}
|
||||
var _markers_to_draw: Dictionary = {}
|
||||
@@ -59,47 +61,47 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
mode_changed.emit(mode)
|
||||
|
||||
|
||||
func show_debug() -> bool:
|
||||
static func show_debug() -> bool:
|
||||
return mode == Mode.FULL or mode == Mode.TEXT
|
||||
|
||||
|
||||
func text(key: String, value: Variant, label_index: int = 1) -> void:
|
||||
static func text(key: String, value: Variant, label_index: int = 1) -> void:
|
||||
if not show_debug():
|
||||
return
|
||||
|
||||
_text_to_draw[key] = {"value": value, "label_index": label_index}
|
||||
instance._text_to_draw[key] = {"value": value, "label_index": label_index}
|
||||
|
||||
|
||||
func add_event(key: String) -> void:
|
||||
_events_to_draw[key] = {"frame": -9999, "args": []}
|
||||
static func add_event(key: String) -> void:
|
||||
instance._events_to_draw[key] = {"frame": -9999, "args": []}
|
||||
|
||||
|
||||
func event_emitted(key: String, args: Array[Variant] = []) -> void:
|
||||
static func event_emitted(key: String, args: Array[Variant] = []) -> void:
|
||||
if not show_debug():
|
||||
return
|
||||
|
||||
_events_to_draw[key] = {"frame": Engine.get_physics_frames(), "args": args}
|
||||
instance._events_to_draw[key] = {"frame": Engine.get_physics_frames(), "args": args}
|
||||
|
||||
|
||||
func vector(
|
||||
static func vector(
|
||||
key: String, from: Vector3, to: Vector3, color: Color = DEFAULT_COLOR
|
||||
) -> void:
|
||||
if not show_debug():
|
||||
return
|
||||
|
||||
_vectors_to_draw[key] = {"from": from, "to": to, "color": color, "on": true}
|
||||
instance._vectors_to_draw[key] = {"from": from, "to": to, "color": color, "on": true}
|
||||
|
||||
|
||||
func line(
|
||||
static func line(
|
||||
key: String, from: Vector3, to: Vector3, color: Color = DEFAULT_COLOR
|
||||
) -> void:
|
||||
if not show_debug():
|
||||
return
|
||||
|
||||
_lines_to_draw[key] = {"from": from, "to": to, "color": color, "on": true}
|
||||
instance._lines_to_draw[key] = {"from": from, "to": to, "color": color, "on": true}
|
||||
|
||||
|
||||
func marker(
|
||||
static func marker(
|
||||
key: String,
|
||||
pos: Vector3,
|
||||
radius: float = MARKER_RADIUS,
|
||||
@@ -108,14 +110,14 @@ func marker(
|
||||
if not show_debug():
|
||||
return
|
||||
|
||||
_markers_to_draw[key] = ({"pos": pos, "radius": radius, "color": color, "on": true})
|
||||
instance._markers_to_draw[key] = ({"pos": pos, "radius": radius, "color": color, "on": true})
|
||||
|
||||
|
||||
func circle(key: String, pos: Vector3, color: Color = DEFAULT_COLOR) -> void:
|
||||
static func circle(key: String, pos: Vector3, color: Color = DEFAULT_COLOR) -> void:
|
||||
if not show_debug():
|
||||
return
|
||||
|
||||
_circles_to_draw[key] = {"pos": pos, "color": color, "on": true}
|
||||
instance._circles_to_draw[key] = {"pos": pos, "color": color, "on": true}
|
||||
|
||||
|
||||
func _update_visibility() -> void:
|
||||
|
||||
Reference in New Issue
Block a user