2023-06-29 19:45:53 +02:00
|
|
|
# splash.gd
|
|
|
|
# Splash screen
|
|
|
|
#
|
|
|
|
# This file is part of StarOpenSource CORE (SOSCORE)
|
|
|
|
# Made by the StarOpenSource Project and Contributers
|
|
|
|
# Licensed under GNU GPLv3
|
2023-06-29 17:22:13 +02:00
|
|
|
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
|