Add image to README and splash api
This commit is contained in:
parent
e4b3e5d85f
commit
31f854c5c6
7 changed files with 110 additions and 15 deletions
|
@ -1,3 +1,4 @@
|
|||
<p align=center><img width=200px height=200px src="https://git.staropensource.de/staropensource/core/raw/branch/develop/soscore.png"/></p>
|
||||
# StarOpenSource CORE (aka. SOSCORE aka. CORE) [![Please don't upload to GitHub](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page)
|
||||
SOSCORE/CORE is a framework that simplifies development for games and applications made in Godot 4.
|
||||
|
||||
|
|
|
@ -47,3 +47,28 @@ var wmgr_title = "Application/Game using CORE"
|
|||
## 3 | Fullscreen
|
||||
## 4 | Exclusive fullscreen
|
||||
var wmgr_mode = 0
|
||||
|
||||
# Splash
|
||||
## splash_enabled
|
||||
## Type: bool
|
||||
## Default value: false
|
||||
## Enables or disables the splash screen at startup.
|
||||
## Can be manually enabled with core.splash.display()
|
||||
var splash_enabled = true
|
||||
## splash_image
|
||||
## Type: String
|
||||
## Default value: "res://CORE/soscore.png"
|
||||
## The path to your image that will be displayed
|
||||
## in the center of the splash screen.
|
||||
var splash_image = "res://CORE/soscore.png"
|
||||
## splash_image_size
|
||||
## Type: float
|
||||
## Default value: 256
|
||||
## The size of your splash image. Used for both x and y.
|
||||
var splash_image_size = 256
|
||||
## splash_color
|
||||
## Type: String
|
||||
## Default value: "000000"
|
||||
## The splash screen's background color. Do not include
|
||||
## a "#" at the start.
|
||||
var splash_color = "000000"
|
||||
|
|
26
core.gd
26
core.gd
|
@ -9,54 +9,54 @@ extends Node
|
|||
const version = "git-develop"
|
||||
var locked = false
|
||||
var readycount = 0
|
||||
var readylized = false # Fun Fact: "ready" is a signal from "Node" and I (JeremyStarTM) just added "lized" from "initialized" to it to avoid the error thrown by Godot
|
||||
var readylized = false # Fun Fact: "ready" is a signal from "Node" and I (JeremyStarTM) just added "lized" from "initialized" to it to avoid a error thrown by Godot
|
||||
var config = null
|
||||
var wmgr = null
|
||||
var smgr = null
|
||||
var resmgr = null
|
||||
var autoload = null
|
||||
var events = null
|
||||
var splash = null
|
||||
|
||||
func attach(type:String,component:Script) -> void:
|
||||
func attach(type:String,component,do_setup:bool = true) -> void:
|
||||
if locked:
|
||||
return
|
||||
Logger.diag("core","Attaching " + type + " to CORE")
|
||||
var comp = Control.new()
|
||||
comp.name = type
|
||||
comp.set_script(component)
|
||||
var comp = component
|
||||
if do_setup:
|
||||
comp = Control.new()
|
||||
comp.name = type
|
||||
comp.set_script(component)
|
||||
match(type):
|
||||
"config":
|
||||
add_child(comp)
|
||||
config = comp
|
||||
"wmgr":
|
||||
add_child(comp)
|
||||
wmgr = comp
|
||||
"smgr":
|
||||
add_child(comp)
|
||||
smgr = comp
|
||||
"resmgr":
|
||||
add_child(comp)
|
||||
resmgr = comp
|
||||
"autoload":
|
||||
add_child(comp)
|
||||
autoload = comp
|
||||
"events":
|
||||
add_child(comp)
|
||||
events = comp
|
||||
"splash":
|
||||
splash = comp
|
||||
_:
|
||||
Logger.error("core","Failed attaching " + type + " to CORE: Invalid component")
|
||||
comp.free()
|
||||
return
|
||||
add_child(comp)
|
||||
Logger.diag("core","Attached " + type + " successfully")
|
||||
|
||||
func setready() -> void:
|
||||
readycount = readycount+1
|
||||
if readycount == 4:
|
||||
if readycount == 6:
|
||||
readylized = true
|
||||
|
||||
func lock() -> void:
|
||||
locked = true
|
||||
Logger.diag("core","CORE is now locked. No new attachments can be made.")
|
||||
Logger.diag("core","CORE is now locked. No new attachments can be added.")
|
||||
|
||||
func welcome() -> void:
|
||||
Logger.info("core","CORE " + version + " welcomes you!<nl>It seems like everything is working :)")
|
||||
|
|
|
@ -18,6 +18,7 @@ func _ready() -> void:
|
|||
var scr_resmgr = ResourceLoader.load("res://CORE/resmgr.gd")
|
||||
var scr_autoload = ResourceLoader.load("res://CORE/autoload.gd")
|
||||
var scr_events = ResourceLoader.load("res://CORE/events.gd")
|
||||
var scr_splash = ResourceLoader.load("res://CORE/splash.tscn").instantiate()
|
||||
Logger.info("coreloader","Constructing CORE")
|
||||
var core = Control.new()
|
||||
core.name = "core"
|
||||
|
@ -26,8 +27,6 @@ func _ready() -> void:
|
|||
get_tree().root.add_child(core)
|
||||
Logger.info("coreloader","Attaching configuration file to CORE")
|
||||
core.attach("config",scr_config)
|
||||
Logger.info("coreloader","Waiting for CORE to initialize")
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
Logger.info("coreloader","Attaching wmgr to CORE")
|
||||
core.attach("wmgr",scr_wmgr)
|
||||
Logger.info("coreloader","Attaching smgr to CORE")
|
||||
|
@ -38,6 +37,8 @@ func _ready() -> void:
|
|||
core.attach("autoload",scr_autoload)
|
||||
Logger.info("coreloader","Attaching events to CORE")
|
||||
core.attach("events",scr_events)
|
||||
Logger.info("coreloader","Attaching splash to CORE")
|
||||
core.attach("splash",scr_splash,false)
|
||||
Logger.info("coreloader","Locking CORE")
|
||||
core.lock()
|
||||
Logger.info("coreloader","Waiting for CORE to fully initialize")
|
||||
|
|
BIN
soscore.png
Normal file
BIN
soscore.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
34
splash.gd
Normal file
34
splash.gd
Normal file
|
@ -0,0 +1,34 @@
|
|||
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
|
34
splash.tscn
Normal file
34
splash.tscn
Normal file
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://biphpytvqtfes"]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/splash.gd" id="1_n4sar"]
|
||||
[ext_resource type="Texture2D" uid="uid://pmk2jvrmjy5b" path="res://CORE/soscore.png" id="2_5krj5"]
|
||||
|
||||
[node name="splash" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_n4sar")
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 540.0
|
||||
color = Color(0.839216, 0.0196078, 0.196078, 1)
|
||||
|
||||
[node name="Image" type="NinePatchRect" parent="Background"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -128.0
|
||||
offset_top = -128.0
|
||||
offset_right = 128.0
|
||||
offset_bottom = 128.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_5krj5")
|
Loading…
Reference in a new issue