CORE/splash.gd

40 lines
961 B
GDScript

# splash.gd
# Splash screen
#
# This file is part of StarOpenSource CORE (SOSCORE)
# Made by the StarOpenSource Project and Contributers
# Licensed under GNU GPLv3
extends Node
@onready
var core = get_node("/root/core")
@onready
var enabled = core.config.splash_enabled
@onready
var image = core.config.splash_image
@onready
var image_size = core.config.splash_image_size
@onready
var color = core.config.splash_color
func _ready() -> void:
apply_config()
if enabled:
display()
else:
$Background.visible = false
core.setready()
func apply_config() -> void:
$Background.color = color
$Background/Image.texture = ResourceLoader.load(image)
$Background/Image.size = Vector2i(image_size,image_size)
func display() -> void:
Logger.info("splash","Displaying splash screen")
get_tree().root.move_child($"/root/ccr",0)
$Background.visible = true
func dissolve() -> void:
Logger.info("splash","Dissolving splash screen")
$Background.visible = false