CORE/splash.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

45 lines
1.3 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 = null
var logger = null
# Config
var config_enabled = null
var config_image = null
var config_image_size = null
var config_color = null
# Makes the splash screen pretty
func apply_config() -> void:
if core.protection_mode: return
$Background.color = config_color
$Background/Image.texture = ResourceLoader.load(config_image)
$Background/Image.size = Vector2i(config_image_size,config_image_size)
if config_enabled:
display()
else:
$Background.visible = false
# The next two functions are very self explanitory
func display() -> void:
if core.protection_mode: return
logger.info("CORE/splash.gd","Displaying splash screen")
get_tree().root.move_child($"/root/CORE/",0)
$Background.visible = true
func dissolve() -> void:
if core.protection_mode: return
logger.info("CORE/splash.gd","Dissolving splash screen")
$Background.visible = false