JeremyStarTM
99703cf03e
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>
2.4 KiB
2.4 KiB
hide | |
---|---|
|
Quick Start Guide
Welcome to the CORE quick start guide! Here you'll learn how to use CORE efficently and how to start your journey with CORE.
Note
Please do NOT continue if CORE is not installed or not working for you. You can install CORE by visiting this guide
WARNING
This quick start guide is work in progress and will heavily change over time. The information at this point in time is accurate but incomplete.
Introduction I: The configuration file
The configuration file can be used to configure CORE to your liking and tweak it's behaviour. You can edit the configuration permanently in res://CORE/config.gd
or overwrite the config temporarily in memory using this example:
extends Node
@onready
var core: Node = get_node("/root/CORE")
@onready
var config: Node = core.get_module("Config") #(1)!
func _ready() -> void:
logger.diag("init.gd","This diagnostic message will be hidden unless enabled permanently.") #(2)!
config.logger_diagnostic = true #(3)!
core.reload_config() #(4)!
logger.diag("init.gd","This diagnostic message will be displayed even if disabled permanently as we overwrote the setting in memory.") #(5)!
- Imports the config module for configuration access
- Will be hidden unless logger_diagnostic is set to true permanently
- Overwrites the configuration setting "logger_diagnostic" in memory
- Tells CORE to apply config changes
- Will be displayed even if logger_diagnostic is set to false permanently as we overwrote the value in memory and set it to true
## Introduction II: The init script
The initialization script (you specified in the configuration file) is injected into the SceneTree after CORE completed it's startup procedure. Your init script is responsible for loading and displaying your application. Here's a basic example of `res://init.gd` loading a scene located at `res://testscene.tscn` and freeing itself.
```gdscript
extends Node
@onready
var core: Node = get_node("/root/CORE")
@onready
var resourcemanager: Node = core.get_module("ResourceManager")
@onready
var scenemanager: Node = core.get_module("SceneManager")
func _ready() -> void:
logger.info("init.gd","Loading testscene")
resourcemanager.load("testscene","res://testscene.tscn")
logger.info("init.gd","Injecting testscene into SceneTree under the action overlay.")
scenemanager.add_game("testscene")
logger.info("init.gd","Removing init script")
queue_free()