add text only mode to debug

This commit is contained in:
Teatov 2025-02-27 23:00:23 +10:00
parent f85e7a2715
commit 53e444a568
2 changed files with 13 additions and 14 deletions

View File

@ -3,7 +3,7 @@ extends CanvasLayer
signal mode_changed(mode: Mode) signal mode_changed(mode: Mode)
enum Mode { DISABLED, PERFORMANCE, FULL } enum Mode { DISABLED, PERFORMANCE, TEXT, FULL }
const LINE_WIDTH: float = 2 const LINE_WIDTH: float = 2
const MARKER_RADIUS: float = 0.2 const MARKER_RADIUS: float = 0.2
@ -59,7 +59,7 @@ func _unhandled_input(event: InputEvent) -> void:
func show_debug() -> bool: func show_debug() -> bool:
return mode == Mode.FULL return mode == Mode.FULL or mode == Mode.TEXT
func text(key: String, value: Variant, label_index: int = 1) -> void: func text(key: String, value: Variant, label_index: int = 1) -> void:
@ -284,22 +284,22 @@ func _on_control_draw() -> void:
_append_text("fps", Engine.get_frames_per_second() as int, 0) _append_text("fps", Engine.get_frames_per_second() as int, 0)
if mode != Mode.FULL: if mode == Mode.PERFORMANCE:
if mode != Mode.DISABLED: _set_label_texts()
_set_label_texts()
return return
for k: String in _text_to_draw.keys(): if mode == Mode.TEXT or mode == Mode.FULL:
var v: Dictionary = _text_to_draw[k] for k: String in _text_to_draw.keys():
_append_text(k, v["value"] as Variant, v["label_index"] as int) var v: Dictionary = _text_to_draw[k]
_append_text(k, v["value"] as Variant, v["label_index"] as int)
for k: String in _events_to_draw.keys(): for k: String in _events_to_draw.keys():
var v: Dictionary = _events_to_draw[k] var v: Dictionary = _events_to_draw[k]
_append_event(k, v["frame"] as int, v["args"] as Array[Variant]) _append_event(k, v["frame"] as int, v["args"] as Array[Variant])
_set_label_texts() _set_label_texts()
if !Referencer.main_camera: if !Referencer.main_camera or mode != Mode.FULL:
return return
for v: Dictionary in _vectors_to_draw.values(): for v: Dictionary in _vectors_to_draw.values():

View File

@ -45,7 +45,6 @@ func _on_body_entered(node: Node3D) -> void:
queue_free() queue_free()
return return
print(node)
if node is CollisionObject3D: if node is CollisionObject3D:
var collision_node := node as CollisionObject3D var collision_node := node as CollisionObject3D
if collision_node.collision_layer & 1: if collision_node.collision_layer & 1: