CORE/corelog.gd
JeremyStarTM b57d00e9cd Many improvements (see commit description)
Added more things to roadmap, removed autoload singleton check, added support for Godot 4.1, all startup messages now use Logger.diag() instead of Logger.info() (making them disappear but can be shown if needed), removed autoload.gd, fixes syntax.
2023-07-07 10:58:49 +02:00

38 lines
1.5 KiB
GDScript

# corelog.gd
# CORE Log
#
# This file is part of StarOpenSource CORE (SOSCORE)
# Made by the StarOpenSource Project and Contributers
# Licensed under GNU GPLv3
extends RichTextLabel
var log_prefix = ""
var log_suffix = ""
func _ready() -> void:
# Enable recieving of log messages
Logger.connect("logevent",Callable(self,"logevent"))
# Disable VScrollBar functionality & visibility
get_child(0,true).add_theme_stylebox_override("grabber",StyleBoxEmpty.new())
get_child(0,true).add_theme_stylebox_override("grabber_highlight",StyleBoxEmpty.new())
get_child(0,true).add_theme_stylebox_override("grabber_pressed",StyleBoxEmpty.new())
get_child(0,true).add_theme_stylebox_override("scroll",StyleBoxEmpty.new())
get_child(0,true).add_theme_stylebox_override("scroll_focus",StyleBoxEmpty.new())
get_child(0,true).set_deferred("size",Vector2i(0,0))
get_child(0,true).mouse_filter = Control.MOUSE_FILTER_IGNORE
# Make RichTextLabel ignore all mouse events (to disable scrolling)
mouse_filter = Control.MOUSE_FILTER_IGNORE
func _process(_delta) -> void:
var windowsize = DisplayServer.window_get_size()
$".".size = windowsize
get_parent().size = windowsize
get_parent().get_parent().size = windowsize
func logevent(_type:String,_script:String,_message:String,logcomp:String) -> void:
# Appends log to RichTextLabel
text = text + "\n" + log_prefix + logcomp + log_suffix
func rmconnect() -> void:
# Disables recieving of log messages
Logger.disconnect("logevent",Callable(self,"logevent"))