move debugger scene from global to local
This commit is contained in:
@@ -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