Initial Commit
This commit is contained in:
commit
48a5e71e00
1136 changed files with 64347 additions and 0 deletions
54
lib/debugger_window.gd
Normal file
54
lib/debugger_window.gd
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
extends PanelContainer
|
||||
class_name DebuggerWindow
|
||||
|
||||
static var instance: DebuggerWindow
|
||||
@onready var debug_list: VBoxContainer = %DebugList
|
||||
|
||||
var _debuggers: Dictionary[String, Debugger] = {}
|
||||
|
||||
func _ready() -> void:
|
||||
if not instance:
|
||||
instance = self
|
||||
|
||||
func add_debugger(label: String, proc: Callable, async: bool = false) -> void:
|
||||
var dbgr := Debugger.new(label, proc, async)
|
||||
debug_list.add_child(dbgr)
|
||||
_debuggers[name] = dbgr
|
||||
|
||||
func remove_debugger(label: String) -> void:
|
||||
if not _debuggers.has(label): return
|
||||
_debuggers[label].queue_free()
|
||||
_debuggers.erase(label)
|
||||
|
||||
func enable_debugger(label: String) -> void:
|
||||
if not _debuggers.has(label): return
|
||||
_debuggers[label].enabled = true
|
||||
|
||||
func disable_debugger(label: String) -> void:
|
||||
if not _debuggers.has(label): return
|
||||
_debuggers[label].enabled = false
|
||||
|
||||
class Debugger:
|
||||
extends HBoxContainer
|
||||
var _label: Label
|
||||
var _field: Label
|
||||
var _proc: Callable
|
||||
var _async: bool
|
||||
var enabled: bool = false
|
||||
|
||||
func _init(label: String, proc: Callable, async: bool = false) -> void:
|
||||
_async = async
|
||||
_proc = proc
|
||||
_label = Label.new()
|
||||
_field = Label.new()
|
||||
_label.text = label
|
||||
add_child(_label)
|
||||
add_child(_field)
|
||||
_field.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if enabled:
|
||||
if _async:
|
||||
_field.text = str(await _proc.call())
|
||||
else:
|
||||
_field.text = str(_proc.call())
|
||||
Loading…
Add table
Add a link
Reference in a new issue