CORE/corelog.gd
JeremyStarTM 99703cf03e CORE rewrite (#1)
Reviewed-on: StarOpenSource/core#1

Rewrote CORE and improved the startup process and startup time significantly. The documentation has been beefed up too and is now much better. Existing projects may need major refactoring however.
Co-authored-by: JeremyStarTM <jeremystartm@staropensource.de>
Co-committed-by: JeremyStarTM <jeremystartm@staropensource.de>
2023-08-25 14:34:57 +02:00

50 lines
1.9 KiB
GDScript

######################################
# THE CORE FRAMEWORK #
# MADE BY THE STAROPENSOURCE PROJECT #
# AND CONTRIBUTERS (THANK YOU!) #
# #
# COPYRIGHT 2023 THE STAROPENSOURCE #
# PROJECT AND CONTRIBUTERS #
# #
# LICENSED UNDER THE GNU GENERAL #
# PUBLIC LICENSE VERSION 3 (ONLY) #
######################################
extends Node
# CORE modules
var core: Node = null
var logger: Node = null
# Initializes CORELog
func initialize() -> void:
if core.protection_mode: return
# logevent (signal) -> logupdate()
logger.connect("logevent",Callable(self,"logupdate"))
# Activate auto scrolling
$Background/Log.scroll_active = true
$Background/Log.scroll_following = true
# Disable mouse influence
$Background/Log.mouse_filter = Control.MOUSE_FILTER_IGNORE
$Background/Log.get_child(0,true).mouse_filter = Control.MOUSE_FILTER_IGNORE
# Remove every VScrollBar style
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber",StyleBoxEmpty.new())
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber_highlight",StyleBoxEmpty.new())
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber_pressed",StyleBoxEmpty.new())
$Background/Log.get_child(0,true).add_theme_stylebox_override("scroll",StyleBoxEmpty.new())
$Background/Log.get_child(0,true).add_theme_stylebox_override("scroll_focus",StyleBoxEmpty.new())
# Set VScollBar size to zero
$Background/Log.get_child(0,true).set_deferred("size",Vector2i(0,0))
# Updates log text
func logupdate(_type:String,_script:String,_method:String,logmessage:String) -> void:
$Background/Log.text = $Background/Log.text + "\n" + logmessage
# These two functions are very self explanitory
func display() -> void:
if core.protection_mode: return
$Background.visible = true
func dissolve() -> void:
if core.protection_mode: return
$Background.visible = false