This repository has been archived on 2025-09-12. You can view files and clone it, but cannot push or open issues or pull requests.
ld48/game/DebugLabel.gd
2021-04-17 22:36:22 +02:00

25 lines
676 B
GDScript

# Copyright 2020 Outfrost
# This work is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the LICENSE.WTFPL file for more details.
class_name DebugLabel
extends Label
var buffer: String = ""
func _ready():
text = ""
func _process(_delta):
text = buffer
buffer = ""
func display_impl(s: String):
buffer += s + "\n"
static func display(ref, s):
var label = ref.get_tree().root.find_node("DebugLabel", true, false) as DebugLabel
if label:
label.display_impl(str(s))