Uncringe the project
This commit is contained in:
parent
6643152e93
commit
ed4647c750
98 changed files with 16057 additions and 3029 deletions
0
.corebasepath
Normal file
0
.corebasepath
Normal file
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
|||
*.import
|
||||
config.gd
|
||||
devprj
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
|
64
Makefile
64
Makefile
|
@ -1,64 +0,0 @@
|
|||
#!/bin/make
|
||||
CORE=$(shell pwd)
|
||||
ASSETS=$(CORE)/assets
|
||||
DOCSCONF=$(CORE)/mkdocs.yml
|
||||
DOCSOUT=$(CORE)/docs_out
|
||||
TESTPROJECT=$(CORE)/devprj
|
||||
|
||||
dist: help
|
||||
help:
|
||||
@echo "Available tasks: docs-deps (installs the docs dependencies via pip)"
|
||||
@echo " docs-deps-paru (install the docs dependencies via paru)"
|
||||
@echo " docs-serve (starts development server)"
|
||||
@echo " docs-build (export prod ready documentation as html)"
|
||||
@echo " docs-clean (removes the built documentation)"
|
||||
@echo " mkdevprj (creates a dev project for development)"
|
||||
@echo " rmdevprj (removes the dev project)"
|
||||
docs-deps:
|
||||
@echo ":: Installing documentation dependencies"
|
||||
@echo " This may take a few minutes"
|
||||
@pip install -r requirements.txt
|
||||
docs-deps-paru:
|
||||
@echo ":: Installing documentation dependencies"
|
||||
@echo " This may take a few minutes"
|
||||
@paru -Sy --needed python-pyyaml-env-tag python-mergedeep python-six python-smmap python-gitdb python-urllib3 python-idna python-dateutil python-pytz python-babel python-requests python-regex python-pygments python-colorama python-watchdog python-packaging python-ghp-import python-click python-jinja python-yaml python-gitpython python-markupsafe pymdown-extensions mkdocs-material-pymdownx-extras mkdocs-git-revision-date-localized-plugin mkdocs-material mkdocs
|
||||
docs-serve:
|
||||
@echo ":: Serving documentation, press CTRL+C to exit"
|
||||
@bash -c "mkdocs serve --dirtyreload --config-file "$(DOCSCONF)";exit 0"
|
||||
docs-build:
|
||||
@make docs-clean
|
||||
@echo ":: Building documentation"
|
||||
@mkdocs build --site-dir "$(DOCSOUT)" --config-file "$(DOCSCONF)"
|
||||
docs-clean:
|
||||
@echo ":: Removing built documentation"
|
||||
@rm -rf "$(DOCSOUT)"
|
||||
mkdevprj:
|
||||
@echo ":: Creating development project"
|
||||
@cp -r $(ASSETS)/testproject $(TESTPROJECT)
|
||||
@ln -s $(CORE) $(TESTPROJECT)/CORE
|
||||
@mv $(TESTPROJECT)/config.gd $(TESTPROJECT)/CORE/config.gd
|
||||
@echo ":: Development project created."
|
||||
@echo " You can now launch Godot and open '$(TESTPROJECT)'."
|
||||
@echo " If you want to submit your changes, remember to execute 'make rmdevprj' first!"
|
||||
rmdevprj:
|
||||
@echo ":: Removing development project"
|
||||
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@echo ":: ! IMPORTANT WARNING !"
|
||||
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@echo ":: ! Please remove the CORE !"
|
||||
@echo ":: ! development project from !"
|
||||
@echo ":: ! your project list or you !"
|
||||
@echo ":: ! will experience bugs if !"
|
||||
@echo ":: ! you edit the dev project !"
|
||||
@echo ":: ! again in the future! !"
|
||||
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@echo ":: If you have done that, press [ENTER]."
|
||||
@read -rs
|
||||
@echo ":: Removing directory"
|
||||
@rm -rf $(TESTPROJECT)
|
||||
@rm -rf config.gd
|
||||
@echo ":: Removing 'uid://' strings"
|
||||
@#bash -c "for file in *.tscn; do cat \"\$$file\"|sed -E 's/\ uid=\"[^\"]*\"//g'|tee \$$file;done &> /dev/null"
|
||||
@echo ":: Please open all .tscn files and remove all 'uid=uid://' strings"
|
||||
@echo ":: If you have done that, press [ENTER]."
|
||||
@read -rs
|
95
README.md
95
README.md
|
@ -1,90 +1,13 @@
|
|||
<p align=center><img width=200px height=200px src="https://git.staropensource.de/staropensource/core/raw/branch/develop/soscore.png" alt="SOSCore icon"/></p>
|
||||
<div align="center">
|
||||
|
||||
# StarOpenSource CORE (aka. SOSCORE aka. CORE)
|
||||
SOSCORE/CORE is a framework that simplifies development for games and applications made in Godot 4.
|
||||
<a href="https://core.staropensource.de">
|
||||
<img src="https://git.staropensource.de/StarOpenSource/core/raw/branch/develop/dist/core.png" alt="CORE Framework" style="border-radius:50%" width="400"/>
|
||||
</a>
|
||||
|
||||
# Development status
|
||||
CORE is under heavy development and can be very unstable. Please do not use CORE in conjunction with your game/application for now (except if you want to debug your game 24/7 and read a lot of gdscript files).
|
||||
**The framework that simplifies your game/application development**
|
||||
|
||||
# Roadmap to release <img width=32 src="https://net.staropensource.de/system/custom_emojis/images/000/016/921/static/1696fdec3a625c30.png" alt=":blobfoxbongo:"/>
|
||||
- Mod loading system
|
||||
- Notification API
|
||||
- Basic debugging tool (CTRL+C to crash, F3 to toggle statistics)
|
||||
- ~~Better documentation (docs4everything)~~
|
||||
- ~~Everything commented and explained~~
|
||||
- Documentation page explaining what does what (for CORE noobies)
|
||||
- ~~Autoload singleton check removal~~
|
||||
- ~~More wmgr functions~~ (the window manager got removed in the rewrite)
|
||||
- ~~Website~~
|
||||
- ~~Silencing startup messages (info -> diag)~~
|
||||
- ~~Remove autoload component~~
|
||||
- ~~Fix syntax (set return types missing)~~
|
||||
- ~~Much more configuration options~~ (CORE's already pretty configurable)
|
||||
- Implement preprocessor placeholders
|
||||
- Clipboard content
|
||||
- CORE version
|
||||
- Dark mode
|
||||
- Dark mode support
|
||||
- Delta
|
||||
- Device hardware
|
||||
- Device model
|
||||
- CPU name
|
||||
- CPU count
|
||||
- FPS
|
||||
- Game process
|
||||
- Executable
|
||||
- Command line options
|
||||
- PID
|
||||
- Debug build
|
||||
- Language
|
||||
- Operating system
|
||||
- Operating system name
|
||||
- Operating system version
|
||||
- Distribution name
|
||||
- Project name
|
||||
- Project description
|
||||
- Rendertime
|
||||
- Window
|
||||
- Size
|
||||
- Size with decorations
|
||||
- Position
|
||||
- Title
|
||||
- Mode
|
||||
- Minimal size
|
||||
- Maximal size
|
||||
- Vsync status
|
||||
- Screen
|
||||
- Size
|
||||
- ID (main window)
|
||||
- Count
|
||||
- DPI
|
||||
- Orientation
|
||||
- Refresh rate
|
||||
- Scale
|
||||
---
|
||||
<a href="https://core.staropensource.de">Documentation</a>
|
||||
---
|
||||
|
||||
# Documentaton
|
||||
[You can access the documentation by clicking this text](https://git.staropensource.de/StarOpenSource/core/wiki)[.](https://takeb1nzyto.space)
|
||||
|
||||
# Can I use CORE in an existing project?
|
||||
Yes, in theory you can refactor your entire codebase and make a giant mess, but we don't recommend doing that.
|
||||
|
||||
# Requirements
|
||||
- Godot 4.1 (stable releases only)
|
||||
- Good experience with Godot 4 and GDScript
|
||||
|
||||
# Recommendations
|
||||
- Use the Scene Manager instead of manually managing scenes or CORE will break apart. If you don't want headaches, use the Scene Manager.
|
||||
- Use the CORE's logger implementation instead of print(). It supports rich formatting (using tags, handled by our Preprocessor™) and is generally better than using print() for everything.
|
||||
|
||||
# How to install
|
||||
- Download the [CORE manager](https://git.staropensource.de/StarOpenSource/core-manager#download) and open it
|
||||
- Enter the path to your Godot project
|
||||
- Click `Install` and wait 0-2 seconds for it to download
|
||||
- Reload your project (`Project -> Reload current project`) and start your game
|
||||
- If Godot complains that it could not load `res://`, then you successfully installed CORE. [You can now follow the post install guide](https://git.staropensource.de/StarOpenSource/core/wiki/Using-CORE)
|
||||
|
||||
# How to update
|
||||
Open the CORE manager, enter the path to your Godot project and click `Update`. Check [this documentation page](https://git.staropensource.de/StarOpenSource/core/wiki/Breaking-commits) for important commits that can cause breakage.
|
||||
|
||||
# Why is CORE not a addon?
|
||||
CORE does not add one single functionality that can be easily removed, no, it is a whole framework providing many useful functions for your game and removing it would mean lots of refactoring and headaches for you. So no, no addon.
|
||||
</div>
|
||||
|
|
51
Test.gd
Normal file
51
Test.gd
Normal file
|
@ -0,0 +1,51 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### Test.gd (Testing script) ###
|
||||
### ###
|
||||
### This script is used to test CORE's behaviour during development. ###
|
||||
### It's state should be reverted to how it was before committing. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
|
||||
# CORE Configuration
|
||||
var config: CoreConfiguration = CoreConfiguration.new()
|
||||
# CORE Object
|
||||
var core: Core
|
||||
|
||||
func _ready() -> void:
|
||||
configure_core()
|
||||
# Initialize CORE with custom config
|
||||
core = Core.new(config)
|
||||
# Inject CORE
|
||||
add_child(core)
|
||||
# Print information about CORE
|
||||
core.logger.info(await core.get_formatted_string("""Version information:
|
||||
Release (semantic) = %release_semantic%
|
||||
Release = %release%
|
||||
Type = %type%
|
||||
Type (technical) = %type_technical%
|
||||
Typerelease = %release_type%
|
||||
Development mode = %devmode%
|
||||
Headless mode = %headless%"""))
|
||||
|
||||
# Update CORE configuration
|
||||
func configure_core() -> void:
|
||||
config.headless = false
|
||||
config.debug_allow = true
|
||||
config.logger_level = CoreTypes.LoggerLevel.DIAG
|
12
Test.tscn
Normal file
12
Test.tscn
Normal file
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://ckhfu6nkw6c6g"]
|
||||
|
||||
[ext_resource type="Script" path="res://Test.gd" id="1_87mte"]
|
||||
|
||||
[node name="Test" 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_87mte")
|
|
@ -1,24 +0,0 @@
|
|||
extends Node
|
||||
|
||||
var core_initscript: String = "res://init.gd"
|
||||
|
||||
var preprocessor_enabled: bool = true
|
||||
var preprocessor_diagnostic: bool = false
|
||||
|
||||
var logger_enabled: bool = true
|
||||
var logger_diagnostic: bool = false
|
||||
|
||||
var corelog_enabled: bool = true
|
||||
|
||||
var debugdisplay_enabled: bool = false
|
||||
var debugdisplay_fps: bool = true
|
||||
var debugdisplay_delta: bool = true
|
||||
var debugdisplay_rendertime: bool = true
|
||||
var debugdisplay_memory: bool = true
|
||||
|
||||
var resourcemanager_load_invalid_file_as_null: bool = false
|
||||
|
||||
var splash_enabled: bool = false
|
||||
var splash_image: String = "res://CORE/soscore.png"
|
||||
var splash_image_size: int = 256
|
||||
var splash_color: String = "000000"
|
|
@ -1,9 +0,0 @@
|
|||
extends Node
|
||||
|
||||
@onready
|
||||
var core: Node = get_node("/root/CORE")
|
||||
@onready
|
||||
var logger: Node = core.get_module("Logger")
|
||||
|
||||
func _ready() -> void:
|
||||
logger.info("init.gd","init.gd loaded.")
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"wanted": {
|
||||
"min_version": 1,
|
||||
"max_version": 1,
|
||||
"min_api": 1,
|
||||
"max_api": 1
|
||||
},
|
||||
"mod": {
|
||||
"name": "CORE Test Mod",
|
||||
"version": 1,
|
||||
"version_friendly": 1.0,
|
||||
"authors": [
|
||||
"The CORE Team"
|
||||
],
|
||||
"license": "GNU General Public License v3",
|
||||
"entrypoint": "testmod.gd"
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
extends Node
|
||||
|
||||
@onready
|
||||
var core: Node = get_node("/root/core")
|
||||
@onready
|
||||
var logger: Node = core.get_module("Logger")
|
||||
|
||||
func _start() -> String:
|
||||
await get_tree().create_timer(0).timeout
|
||||
logger.info("testmod","_start() has been called.")
|
||||
return ""
|
||||
|
||||
func _stop() -> void:
|
||||
await get_tree().create_timer(0).timeout
|
||||
logger.info("testmod","_stop() has been called.")
|
126
cml.gd
126
cml.gd
|
@ -1,126 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Configuration
|
||||
var config_loadpath = null
|
||||
var config_wanted_name = null
|
||||
var config_wanted_version = null
|
||||
var config_wanted_api = null
|
||||
|
||||
# Modification list
|
||||
var modlist = []
|
||||
# Hook list
|
||||
var hooks = {}
|
||||
|
||||
func load_mods() -> Array:
|
||||
if core.protection_mode: return []
|
||||
var errors: Array = []
|
||||
for directory in DirAccess.get_directories_at(config_loadpath):
|
||||
var return_value: String = await load_mod(directory)
|
||||
if return_value != "":
|
||||
errors.append(return_value)
|
||||
return errors
|
||||
|
||||
func load_mod(mod_name:String) -> String:
|
||||
logger.info("CORE/cml.gd","Loading modification \"" + mod_name + "\"")
|
||||
if modlist.has(mod_name):
|
||||
logger.error("CORE/cml.gd","Modification \"" + mod_name + "\" is already loaded")
|
||||
if !FileAccess.file_exists(config_loadpath + "/" + mod_name + "/" + config_wanted_name + ".coremod"):
|
||||
logger.error("CORE/cml.gd","Modification located at " + config_loadpath + "/" + mod_name + " does not contain a " + config_wanted_name + ".coremod file")
|
||||
return "Modification located at " + config_loadpath + "/" + mod_name + " does not contain a " + config_wanted_name + ".coremod file"
|
||||
var modinfo_raw: FileAccess = FileAccess.open(config_loadpath + "/" + mod_name + "/" + config_wanted_name + ".coremod",FileAccess.READ)
|
||||
var modinfo: Dictionary = JSON.parse_string(modinfo_raw.get_as_text())
|
||||
modinfo_raw.close()
|
||||
if modinfo == null:
|
||||
logger.error("CORE/cml.gd","Failed modinfo parsing for modification located at " + config_loadpath + "/" + mod_name)
|
||||
return "Failed modinfo parsing for modification located at " + config_loadpath + "/" + mod_name
|
||||
if !modinfo.has_all(["wanted","mod"]):
|
||||
logger.error("CORE/cml.gd","The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted, mod or both")
|
||||
return "The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted, mod or both"
|
||||
if !modinfo["wanted"].has_all(["min_version","max_version","min_api","max_api"]):
|
||||
logger.error("CORE/cml.gd","The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted.min_version, wanted.max_version, wanted.min_api or wanted.max_api or some combination of them.")
|
||||
return "The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain wanted.min_version, wanted.max_version, wanted.min_api or wanted.max_api or some combination of them."
|
||||
if !modinfo["mod"].has_all(["name","version","authors","license","entrypoint"]):
|
||||
logger.error("CORE/cml.gd","The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain mod.name, mod.version, mod.authors, mod.license or mod.entrypoint or some combination of them.")
|
||||
return "The modinfo of modification located at " + config_loadpath + "/" + mod_name + " does not contain mod.name, mod.version, mod.authors, mod.license or mod.entrypoint or some combination of them."
|
||||
if not modinfo["wanted"]["min_version"] <= config_wanted_version or not modinfo["wanted"]["max_version"] >= config_wanted_version:
|
||||
logger.error("CORE/cml.gd","The modification \"" + modinfo["mod"]["name"] + " does not match wanted version " + str(config_wanted_version))
|
||||
return "The modification \"" + modinfo["mod"]["name"] + " does not match wanted version " + str(config_wanted_version)
|
||||
if not modinfo["wanted"]["min_api"] <= config_wanted_api or not modinfo["wanted"]["max_api"] >= config_wanted_api:
|
||||
logger.error("CORE/cml.gd","The modification \"" + modinfo["mod"]["name"] + " does not match wanted api " + str(config_wanted_api))
|
||||
return "The modification \"" + modinfo["mod"]["name"] + " does not match wanted api " + str(config_wanted_api)
|
||||
if !FileAccess.file_exists(config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"]):
|
||||
logger.error("CORE/cml.gd","The entrypoint for the modification \"" + modinfo["mod"]["name"] + "\" located at \"" + config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"] + "\" does not exist")
|
||||
return "The entrypoint for the modification \"" + modinfo["mod"]["name"] + "\" located at \"" + config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"] + "\" does not exist"
|
||||
|
||||
var entrypoint_script: Script = ResourceLoader.load(config_loadpath + "/" + mod_name + "/" + modinfo["mod"]["entrypoint"])
|
||||
var entrypoint: Node = Node.new()
|
||||
entrypoint.name = mod_name
|
||||
entrypoint.set_script(entrypoint_script)
|
||||
get_tree().root.add_child(entrypoint)
|
||||
var mod_err: String = await get_node("/root/" + mod_name)._start()
|
||||
if mod_err == "":
|
||||
modlist.append(mod_name)
|
||||
return ""
|
||||
else:
|
||||
get_tree().root.remove_child(entrypoint)
|
||||
return "Modification \"" + mod_name + "\" could not be loaded as it returned this error: " + mod_err
|
||||
|
||||
func unload_mods() -> void:
|
||||
for mod in modlist:
|
||||
await unload_mod(mod)
|
||||
|
||||
func unload_mod(mod_name:String) -> void:
|
||||
logger.info("CORE/cml.gd","Unloading modification \"" + mod_name + "\"")
|
||||
if !modlist.has(mod_name):
|
||||
logger.error("CORE/cml.gd","Modification \"" + mod_name + "\" is not loaded")
|
||||
if get_tree().root.get_node_or_null(mod_name) == null:
|
||||
core.exception("CORE/cml.gd","Could not locate mod entrypoint script for mod \"" + mod_name + "\" during unload")
|
||||
return
|
||||
await get_node("/root/" + mod_name)._stop()
|
||||
get_tree().root.remove_child(get_node("/root/" + mod_name))
|
||||
modlist.erase(mod_name)
|
||||
|
||||
func register_hook(mod_name:String,hook_name:String,hook_action:int,method:Callable) -> bool:
|
||||
if !modlist.has(mod_name):
|
||||
core.exception("CORE/cml.gd","Failed registering hook \"" + hook_name + "\" for mod \"" + mod_name + "\" as it does not exist or is not loaded")
|
||||
return false
|
||||
core.exception("CORE/cml.gd","Function not implemented")
|
||||
return true
|
||||
|
||||
func get_list() -> Array:
|
||||
return modlist
|
||||
|
||||
func get_info(mod_name:String) -> Dictionary:
|
||||
if !modlist.has(mod_name):
|
||||
return {"error":"Modification \"" + mod_name + "\" is not loaded"}
|
||||
var modinfo_raw: FileAccess = FileAccess.open(config_loadpath + "/" + mod_name + "/" + config_wanted_name + ".coremod",FileAccess.READ)
|
||||
var modinfo: Dictionary = JSON.parse_string(modinfo_raw.get_as_text())
|
||||
modinfo_raw.close()
|
||||
if modinfo == null:
|
||||
return {"error":"Failed parsing modinfo for modification \"" + mod_name + "\""}
|
||||
return modinfo
|
||||
|
||||
func load_configuration() -> void:
|
||||
if core.protection_mode: return
|
||||
config_loadpath = core.config.cml_loadpath
|
||||
config_wanted_name = core.config.cml_wanted_name
|
||||
config_wanted_version = core.config.cml_wanted_version
|
||||
if core.config.get("cml_wanted_api") == null:
|
||||
config_wanted_api = config_wanted_version
|
||||
else:
|
||||
config_wanted_api = core.config.cml_wanted_api
|
|
@ -1,45 +0,0 @@
|
|||
##############################
|
||||
# THE CORE FRAMEWORK #
|
||||
# EXAMPLE CONFIGURATION FILE #
|
||||
# #
|
||||
# THIS DOCUMENT IS PUBLICLY #
|
||||
# AVAILABLE UNDER THE PUBLIC #
|
||||
# DOMAIN AND IS NOT LICENSED #
|
||||
##############################
|
||||
extends Node
|
||||
|
||||
# Hello there, fellow developer!
|
||||
# This is a example configuration file
|
||||
# for the CORE Framework (source 0).
|
||||
#
|
||||
# Most settings in this config should be
|
||||
# self explanitory. If not, visit the documentation:
|
||||
# https://core.staropensource.de/references/Configuration_File/
|
||||
#
|
||||
# Thank you for using the CORE Framework!
|
||||
# - The StarOpenSource Project & Contributers
|
||||
|
||||
var core_initscript: String = "res://init.gd"
|
||||
|
||||
var preprocessor_enabled: bool = true
|
||||
var preprocessor_diagnostic: bool = false
|
||||
|
||||
var logger_enabled: bool = true
|
||||
var logger_diagnostic: bool = false
|
||||
|
||||
var corelog_enabled: bool = true
|
||||
|
||||
var debugdisplay_enabled: bool = false
|
||||
var debugdisplay_fps: bool = true
|
||||
var debugdisplay_delta: bool = true
|
||||
var debugdisplay_rendertime: bool = true
|
||||
var debugdisplay_memory: bool = true
|
||||
|
||||
var resourcemanager_load_invalid_file_as_null: bool = false
|
||||
|
||||
var splash_enabled: bool = false
|
||||
var splash_image: String = "res://CORE/soscore.png"
|
||||
var splash_image_size: int = 256
|
||||
var splash_color: String = "000000"
|
||||
|
||||
# EOF <- Yes, this is the end of the example configuration! Pretty short, isn't it?
|
231
core.gd
231
core.gd
|
@ -1,231 +0,0 @@
|
|||
######################################
|
||||
# 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 logger: Node = null
|
||||
var preprocessor: Node = null
|
||||
var config: Node = null
|
||||
|
||||
# Version
|
||||
const version: Dictionary = {"type":"source","releasebuild":0,"full":"source 0"}
|
||||
# Protection mode
|
||||
var protection_mode: bool = false
|
||||
# Development mode
|
||||
var development_mode: bool = false
|
||||
# Loadpath (from coreinit.gd)
|
||||
var loadpath: String = ""
|
||||
|
||||
# Errors
|
||||
enum Errors {
|
||||
OK,
|
||||
CORE_PROTECTIONMODE,
|
||||
CORE_EXCEPTION,
|
||||
CORE_INVALID_MODULE,
|
||||
RESOURCEMANAGER_ALREADY_EXISTS,
|
||||
RESOURCEMANAGER_INVALID_FILEPATH,
|
||||
RESOURCEMANAGER_RESOURCE_MISSING,
|
||||
RESOURCEMANAGER_BATCH_EMPTY,
|
||||
SCENEMANAGER_ALREADY_LOADED,
|
||||
SCENEMANAGER_NOT_LOADED,
|
||||
SCENEMANAGER_NOT_PACKEDSCENE
|
||||
}
|
||||
|
||||
func welcome() -> void:
|
||||
if protection_mode: return
|
||||
logger.info("CORE/core.gd","CORE (" + version["full"] + ") welcomes you!<nl>It seems like everything is working :)")
|
||||
|
||||
func reload_config() -> void:
|
||||
var corelog: Node = get_node("/root/CORE/CORELog")
|
||||
var debugdisplay: Node = get_node("/root/CORE/DebugDisplay")
|
||||
var resourcemanager: Node = get_node("/root/CORE/ResourceManager")
|
||||
var splash: Node = get_node("/root/CORE/SplashScreen")
|
||||
preprocessor.enabled = get_config("preprocessor_enabled",true)
|
||||
preprocessor.diagnostic = get_config("preprocessor_diagnostic",false)
|
||||
logger.enabled = get_config("logger_enabled",true)
|
||||
logger.diagnostic = get_config("logger_diagnostic",false)
|
||||
if get_config("corelog_enabled",true):
|
||||
corelog.display()
|
||||
else:
|
||||
corelog.dissolve()
|
||||
debugdisplay.config_enabled = get_config("debugdisplay_enabled",true)
|
||||
debugdisplay.config_fps = get_config("debugdisplay_fps",true)
|
||||
debugdisplay.config_delta = get_config("debugdisplay_delta",true)
|
||||
debugdisplay.config_rendertime = get_config("debugdisplay_rendertime",true)
|
||||
debugdisplay.config_memory = get_config("debugdisplay_memory",true)
|
||||
resourcemanager.config_load_invalid_file_as_null = get_config("resourcemanager_load_invalid_file_as_null",false)
|
||||
splash.config_enabled = get_config("splash_enabled",false)
|
||||
splash.config_image = get_config("splash_image","[LOADPATH]soscore.png").replace("[LOADPATH]",loadpath)
|
||||
splash.config_image_size = get_config("config.splash_image_size",256)
|
||||
splash.config_color = get_config("config.splash_color","#d60532")
|
||||
splash.apply_config()
|
||||
|
||||
func get_config(config_key:StringName,default_value:Variant) -> Variant:
|
||||
if protection_mode: return null
|
||||
if config.get(config_key) == null:
|
||||
return default_value
|
||||
else:
|
||||
return config.get(config_key)
|
||||
|
||||
func get_module(module_name:String) -> Node:
|
||||
if protection_mode: return null
|
||||
if module_name == "CORELog":
|
||||
var err = error("CORE",Errors.CORE_INVALID_MODULE,{"module":module_name})
|
||||
logger.error("CORE/core.gd",err["error"])
|
||||
return err["code"]
|
||||
var module: Node = get_node_or_null("/root/CORE/" + module_name)
|
||||
if module == null:
|
||||
var err = error("CORE",Errors.CORE_INVALID_MODULE,{"module":module_name})
|
||||
logger.error("CORE/core.gd",err["error"])
|
||||
return err["code"]
|
||||
return module
|
||||
|
||||
func devmode():
|
||||
logger.warn("CORE/core.gd","Development mode is now active.<nl>Keep this disabled if you don't know what you're doing<nl>or you may encounter serious issues!<nl><nl>You have been warned!")
|
||||
logger.warn("CORE/core.gd","The development mode does nothing as of now. It is just \"a thing\" implemented for the future")
|
||||
development_mode = true
|
||||
|
||||
func exception(module:String,exception_error:String):
|
||||
protection_mode = true
|
||||
var submit_issue_default = "Please report this crash to the CORE Framework repository (with
|
||||
the full log file). You can submit a crash report at:
|
||||
https://git.staropensource.de/StarOpenSource/core/issues/new"
|
||||
var submit_issue_devmode = """Please do NOT report this crash to the CORE Framework repository
|
||||
as CORE is running in development mode, which is not supported."""
|
||||
var exc_message: String = """
|
||||
[color=red]################################
|
||||
EXCEPTION! EXCEPTION! EXCEPTION!
|
||||
|
||||
The CORE Framework experienced a critical error in runtime.
|
||||
%submit_issue%
|
||||
|
||||
CORE INFORMATION
|
||||
version = "%version%"
|
||||
development_mode = %development_mode%
|
||||
preprocessor_enabled = %preprocessor_enabled%
|
||||
preprocessor_diagnostic = %preprocessor_diagnostic%
|
||||
logger_enabled = %logger_enabled%
|
||||
logger_diagnostic = %logger_diagnostic%
|
||||
|
||||
OPERATING SYSTEM
|
||||
timezone = %timezone%
|
||||
time_utc = "%time_utc%"
|
||||
time_unix = %time_unix%
|
||||
date = "%date%"
|
||||
locale = "%locale%"
|
||||
lang = "%lang%"
|
||||
name = "%name%"
|
||||
distro = "%distro%"
|
||||
version = "%version_os%"
|
||||
memory = %memory%
|
||||
memory_peak = %memory_peak%
|
||||
memory_usage = %memory_usage%
|
||||
processor_count = %processor_count%
|
||||
processor_name = "%processor_name%"
|
||||
video_adapter = %video_adapter%
|
||||
rendering_api = "%rendering_api%"
|
||||
|
||||
APPLICATION
|
||||
cmdline = %cmdline%
|
||||
permissions = %permissions%
|
||||
debug_build = %debug_build%
|
||||
|
||||
ERROR INFORMATION
|
||||
module = "%module%"
|
||||
error = "%error%"
|
||||
|
||||
STACKTRACE
|
||||
%stacktrace%
|
||||
|
||||
EXCEPTION! EXCEPTION! EXCEPTION!
|
||||
################################
|
||||
"""
|
||||
if development_mode:
|
||||
exc_message = exc_message.replace("%submit_issue%",submit_issue_devmode)
|
||||
else:
|
||||
exc_message = exc_message.replace("%submit_issue%",submit_issue_default)
|
||||
exc_message = exc_message.replace("%version%",version["full"])
|
||||
exc_message = exc_message.replace("%development_mode%",str(development_mode))
|
||||
exc_message = exc_message.replace("%preprocessor_enabled%",str(preprocessor.enabled))
|
||||
exc_message = exc_message.replace("%preprocessor_diagnostic%",str(preprocessor.diagnostic))
|
||||
exc_message = exc_message.replace("%logger_enabled%",str(logger.enabled))
|
||||
exc_message = exc_message.replace("%logger_diagnostic%",str(logger.diagnostic))
|
||||
|
||||
exc_message = exc_message.replace("%timezone%",str(Time.get_time_zone_from_system()))
|
||||
exc_message = exc_message.replace("%time_utc%",Time.get_time_string_from_system(true))
|
||||
exc_message = exc_message.replace("%time_unix%",str(Time.get_unix_time_from_datetime_string(Time.get_time_string_from_system(true))))
|
||||
exc_message = exc_message.replace("%date%",Time.get_date_string_from_system(true))
|
||||
exc_message = exc_message.replace("%locale%",OS.get_locale())
|
||||
exc_message = exc_message.replace("%lang%",OS.get_locale_language())
|
||||
exc_message = exc_message.replace("%name%",OS.get_name())
|
||||
exc_message = exc_message.replace("%distro%",OS.get_distribution_name())
|
||||
exc_message = exc_message.replace("%version_os%",OS.get_version())
|
||||
exc_message = exc_message.replace("%memory%",str(OS.get_memory_info()))
|
||||
exc_message = exc_message.replace("%memory_peak%",str(OS.get_static_memory_peak_usage()))
|
||||
exc_message = exc_message.replace("%memory_usage%",str(OS.get_static_memory_usage()))
|
||||
exc_message = exc_message.replace("%processor_count%",str(OS.get_processor_count()))
|
||||
exc_message = exc_message.replace("%processor_name%",OS.get_processor_name())
|
||||
exc_message = exc_message.replace("%video_adapter%",str(OS.get_video_adapter_driver_info()))
|
||||
exc_message = exc_message.replace("%rendering_api%",RenderingServer.get_video_adapter_api_version())
|
||||
|
||||
exc_message = exc_message.replace("%cmdline%",str(OS.get_cmdline_args()))
|
||||
exc_message = exc_message.replace("%permissions%",str(OS.get_granted_permissions()))
|
||||
exc_message = exc_message.replace("%debug_build%",str(OS.is_debug_build()))
|
||||
|
||||
exc_message = exc_message.replace("%module%",module)
|
||||
exc_message = exc_message.replace("%error%",exception_error)
|
||||
exc_message = exc_message.replace("%stacktrace%",str(get_stack()))
|
||||
|
||||
print_rich(exc_message)
|
||||
await get_tree().create_timer(0.25).timeout
|
||||
get_tree().quit(255)
|
||||
|
||||
func error(module:String,error_enum:Errors,error_info:Dictionary = {}) -> Dictionary:
|
||||
match(error_enum):
|
||||
Errors.OK:
|
||||
exception("core","Module \"" + module + "\" tried recieving information about error OK (are you ok?)")
|
||||
Errors.CORE_PROTECTIONMODE:
|
||||
return {"code":9223372036854775807,"error":"CORE is in protection mode and is unavailable"}
|
||||
Errors.CORE_EXCEPTION:
|
||||
return {"code":9223372036854775806,"error":"Launching nuke in 3... 2... 1..."}
|
||||
Errors.CORE_INVALID_MODULE:
|
||||
return {"code":Errors.CORE_INVALID_MODULE,"error":"The CORE module \"" + error_info["module"] + "\" does not exist"}
|
||||
Errors.RESOURCEMANAGER_ALREADY_EXISTS:
|
||||
return {"code":Errors.RESOURCEMANAGER_ALREADY_EXISTS,"error":"Failed loading resource: The resource \"" + error_info["name"] + "\" is already loaded"}
|
||||
Errors.RESOURCEMANAGER_INVALID_FILEPATH:
|
||||
return {"code":Errors.RESOURCEMANAGER_INVALID_FILEPATH,"error":"Failed loading resource: The filepath \"" + error_info["filepath"] + "\" is invalid"}
|
||||
Errors.RESOURCEMANAGER_RESOURCE_MISSING:
|
||||
return {"code":Errors.RESOURCEMANAGER_RESOURCE_MISSING,"error":"Failed unloading resource: The resource \"" + error_info["name"] + "\" is not loaded"}
|
||||
Errors.RESOURCEMANAGER_BATCH_EMPTY:
|
||||
return {"code":Errors.RESOURCEMANAGER_BATCH_EMPTY,"error":"Failed processing batch: The batch is empty"}
|
||||
Errors.SCENEMANAGER_ALREADY_LOADED:
|
||||
if error_info["one_scene_overlay"]:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed adding scene \"" + error_info["scene"] + "\" to overlay \"" + error_info["overlay"] + "\": The overlay is full"}
|
||||
else:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed adding scene \"" + error_info["scene"] + "\" to overlay \"" + error_info["overlay"] + "\": A resource with the same name is already present in that overlay"}
|
||||
Errors.SCENEMANAGER_NOT_LOADED:
|
||||
if error_info["one_scene_overlay"]:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed removing scene \"" + error_info["scene"] + "\" from overlay \"" + error_info["overlay"] + "\": The overlay is empty"}
|
||||
else:
|
||||
return {"code":Errors.SCENEMANAGER_ALREADY_LOADED,"error":"Failed removing scene \"" + error_info["scene"] + "\" from overlay \"" + error_info["overlay"] + "\": A resource with that name could not be found within the overlay"}
|
||||
Errors.SCENEMANAGER_NOT_PACKEDSCENE:
|
||||
return {"code":Errors.SCENEMANAGER_NOT_PACKEDSCENE,"error":"Failed adding scene \"" + error_info["scene"] + "\" to overlay \"" + error_info["overlay"] + "\": The specified resource is not a PackedScene"}
|
||||
_:
|
||||
exception("core","Failed generating error: Invalid error \"" + str(error) + "\"")
|
||||
return error("CORE",Errors.CORE_EXCEPTION)
|
||||
|
||||
func exit_safely(exitcode:int = 0) -> void:
|
||||
if protection_mode: return
|
||||
logger.info("CORE/core.gd","Shutting down...")
|
||||
protection_mode = true
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
get_tree().quit(exitcode)
|
209
coreinit.gd
209
coreinit.gd
|
@ -1,209 +0,0 @@
|
|||
######################################
|
||||
# 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
|
||||
|
||||
var loadpath: String = "res://CORE/"
|
||||
|
||||
# To workaround the "busy setting up children" issue coreinit.gd
|
||||
# "reloads" itself. I don't know why it works, but it works.
|
||||
func _ready() -> void:
|
||||
if name == "COREINIT":
|
||||
initialize()
|
||||
else:
|
||||
print("coreinit -> \"Fixing\" busy setting up children issue")
|
||||
var coreinit_raw: Script = ResourceLoader.load(loadpath + "coreinit.gd")
|
||||
var coreinit: Node = Node.new()
|
||||
coreinit.name = "COREINIT"
|
||||
coreinit.set_script(coreinit_raw)
|
||||
get_tree().root.add_child.call_deferred(coreinit)
|
||||
if loadpath == "":
|
||||
coreinit.set_deferred("loathpath","res://CORE/")
|
||||
else:
|
||||
coreinit.set_deferred("loadpath",loadpath)
|
||||
queue_free()
|
||||
|
||||
# Bootstraps CORE
|
||||
func initialize() -> void:
|
||||
print("coreinit -> Bootstrapping CORE")
|
||||
# Check requirements and quit if not met
|
||||
if !check_requirements():
|
||||
await get_tree().create_timer(0.25).timeout
|
||||
get_tree().quit(255)
|
||||
return
|
||||
# Load module scripts and scenes
|
||||
print("coreinit -> Loading modules")
|
||||
var mod_config_raw: Script = ResourceLoader.load(loadpath + "config.gd")
|
||||
var mod_corelog_raw: PackedScene = ResourceLoader.load(loadpath + "corelog.tscn")
|
||||
var mod_logger_raw: Script = ResourceLoader.load(loadpath + "logger.gd")
|
||||
var mod_preprocessor_raw: Script = ResourceLoader.load(loadpath + "preprocessor.gd")
|
||||
var mod_core_raw: Script = ResourceLoader.load(loadpath + "core.gd")
|
||||
var mod_misc_raw: Script = ResourceLoader.load(loadpath + "misc.gd")
|
||||
var mod_debugdisplay_raw: PackedScene = ResourceLoader.load(loadpath + "debugdisplay.tscn")
|
||||
var mod_splash_raw: PackedScene = ResourceLoader.load(loadpath + "splash.tscn")
|
||||
var mod_resmgr_raw: Script = ResourceLoader.load(loadpath + "resmgr.gd")
|
||||
var mod_smgr_raw: Script = ResourceLoader.load(loadpath + "smgr.gd")
|
||||
var mod_events_raw: Script = ResourceLoader.load(loadpath + "events.gd")
|
||||
#var mod_cml_raw: Script = ResourceLoader.load(loadpath + "cml.gd")
|
||||
var mod_mkdown_raw: Script = ResourceLoader.load(loadpath + "mkdown.gd")
|
||||
# Create nodes and add the raw scripts + give them names
|
||||
print("coreinit -> Constructing modules")
|
||||
var mod_config: Node = Node.new()
|
||||
mod_config.name = "Config"
|
||||
mod_config.set_script(mod_config_raw)
|
||||
var mod_preprocessor: Node = Node.new()
|
||||
mod_preprocessor.name = "Preprocessor"
|
||||
mod_preprocessor.set_script(mod_preprocessor_raw)
|
||||
var mod_logger: Node = Node.new()
|
||||
mod_logger.name = "Logger"
|
||||
mod_logger.set_script(mod_logger_raw)
|
||||
var mod_corelog: Node = mod_corelog_raw.instantiate()
|
||||
mod_corelog.name = "CORELog"
|
||||
var mod_core: Node = Node.new()
|
||||
mod_core.name = "CORE"
|
||||
mod_core.set_script(mod_core_raw)
|
||||
mod_core.loadpath = loadpath
|
||||
var mod_misc: Node = Node.new()
|
||||
mod_misc.name = "Miscellaneous"
|
||||
mod_misc.set_script(mod_misc_raw)
|
||||
var mod_debugdisplay: Node = mod_debugdisplay_raw.instantiate()
|
||||
mod_debugdisplay.name = "DebugDisplay"
|
||||
var mod_splash: Node = mod_splash_raw.instantiate()
|
||||
mod_splash.name = "SplashScreen"
|
||||
var mod_resmgr: Node = Node.new()
|
||||
mod_resmgr.name = "ResourceManager"
|
||||
mod_resmgr.set_script(mod_resmgr_raw)
|
||||
var mod_smgr: Node = Node.new()
|
||||
mod_smgr.name = "SceneManager"
|
||||
mod_smgr.set_script(mod_smgr_raw)
|
||||
var mod_events: Node = Node.new()
|
||||
mod_events.name = "Events"
|
||||
mod_events.set_script(mod_events_raw)
|
||||
#var mod_cml: Node = Node.new()
|
||||
#mod_cml.name = "ModLoader"
|
||||
#mod_cml.set_script(mod_cml_raw)
|
||||
var mod_mkdown: Node = Node.new()
|
||||
mod_mkdown.name = "Markdown"
|
||||
mod_mkdown.set_script(mod_mkdown_raw)
|
||||
# Add all modules to /root/
|
||||
print("coreinit -> Injecting modules")
|
||||
get_tree().root.add_child(mod_core)
|
||||
mod_core.add_child(mod_config)
|
||||
mod_core.add_child(mod_preprocessor)
|
||||
mod_core.add_child(mod_logger)
|
||||
mod_core.add_child(mod_misc)
|
||||
mod_core.add_child(mod_corelog)
|
||||
mod_core.add_child(mod_debugdisplay)
|
||||
mod_core.add_child(mod_splash)
|
||||
mod_core.add_child(mod_resmgr)
|
||||
mod_core.add_child(mod_smgr)
|
||||
#mod_core.add_child(mod_cml)
|
||||
mod_core.add_child(mod_events)
|
||||
mod_core.add_child(mod_mkdown)
|
||||
# Updates references to other modules
|
||||
print("coreinit -> Updating dependency references")
|
||||
mod_corelog.core = mod_core
|
||||
mod_corelog.logger = mod_logger
|
||||
mod_preprocessor.core = mod_core
|
||||
mod_preprocessor.logger = mod_logger
|
||||
mod_logger.core = mod_core
|
||||
mod_logger.preprocessor = mod_preprocessor
|
||||
mod_core.logger = mod_logger
|
||||
mod_core.preprocessor = mod_preprocessor
|
||||
mod_core.config = mod_config
|
||||
mod_misc.core = mod_core
|
||||
mod_debugdisplay.core = mod_core
|
||||
mod_debugdisplay.misc = mod_misc
|
||||
mod_splash.core = mod_core
|
||||
mod_splash.logger = mod_logger
|
||||
mod_resmgr.core = mod_core
|
||||
mod_resmgr.logger = mod_logger
|
||||
mod_smgr.logger = mod_logger
|
||||
mod_smgr.core = mod_core
|
||||
mod_smgr.resourcemanager = mod_resmgr
|
||||
mod_events.core = mod_core
|
||||
#mod_cml.core = mod_core
|
||||
#mod_cml.logger = mod_logger
|
||||
mod_events.logger = mod_logger
|
||||
mod_mkdown.core = mod_core
|
||||
mod_mkdown.logger = mod_logger
|
||||
# Apply config to base modules
|
||||
print("coreinit -> Applying configuration to base modules")
|
||||
mod_preprocessor.enabled = get_config(mod_config,"preprocessor_enabled",true)
|
||||
mod_preprocessor.diagnostic = get_config(mod_config,"preprocessor_diagnostic",false)
|
||||
mod_logger.enabled = get_config(mod_config,"logger_enabled",true)
|
||||
mod_logger.diagnostic = get_config(mod_config,"logger_diagnostic",false)
|
||||
if get_config(mod_config,"corelog_enable",true):
|
||||
mod_corelog.display()
|
||||
else:
|
||||
mod_corelog.dissolve()
|
||||
# Call initialize() on base modules
|
||||
print("coreinit -> Initializing base modules")
|
||||
mod_corelog.initialize()
|
||||
mod_logger.initialize()
|
||||
mod_preprocessor.initialize()
|
||||
# Apply config to all modules
|
||||
mod_logger.diag("CORE/coreinit.gd","Reloading configuration")
|
||||
mod_core.reload_config()
|
||||
# Call initialize() method on all modules
|
||||
mod_logger.diag("CORE/coreinit.gd","Initializing modules")
|
||||
#mod_splash.initialize() ## Has no initialize() method
|
||||
#mod_resmgr.initialize() ## Has no initialize() method
|
||||
mod_smgr.initialize()
|
||||
#mod_cml.initialize()
|
||||
mod_events.initialize()
|
||||
# Inject init script
|
||||
mod_logger.diag("CORE/coreinit.gd","Loading init script")
|
||||
if !FileAccess.file_exists(get_config(mod_config,"startup_script","res://init.gd")):
|
||||
mod_core.exception("CORE/coreinit.gd","Startup script located at \"" + get_config(mod_config,"startup_script","res://init.gd") + "\" does not exist")
|
||||
return
|
||||
var initscr_raw: Script = ResourceLoader.load(get_config(mod_config,"core_initscript","res://init.gd"))
|
||||
mod_logger.diag("CORE/coreinit.gd","Constructing init script")
|
||||
var initscr: Node = Node.new()
|
||||
initscr.name = "InitializationScript"
|
||||
initscr.set_script(initscr_raw)
|
||||
mod_logger.diag("CORE/coreinit.gd","Injecting init script")
|
||||
get_tree().root.add_child(initscr)
|
||||
mod_logger.diag("CORE/coreinit.gd","Bootstrapped CORE, exiting.")
|
||||
queue_free()
|
||||
|
||||
# Retrieves a key's value from the configuration file
|
||||
func get_config(config:Node,config_key:StringName,default_value:Variant) -> Variant:
|
||||
if config.get(config_key) == null:
|
||||
return default_value
|
||||
else:
|
||||
return config.get(config_key)
|
||||
|
||||
# Check CORE's requirements
|
||||
func check_requirements() -> bool:
|
||||
var engine_version: Dictionary = Engine.get_version_info()
|
||||
print("coreinit -> Checking CORE requirements")
|
||||
# Check if Godot major version is exactly 4
|
||||
if engine_version["major"] != 4:
|
||||
print("coreinit -> Error: CORE only supports Godot 4.1.stable releases.")
|
||||
return false
|
||||
# Check if Godot minor version is exactly 1
|
||||
if engine_version["minor"] != 1:
|
||||
print("coreinit -> Error: CORE only supports Godot 4.1.stable releases.")
|
||||
return false
|
||||
# Check if Godot release channel is "stable"
|
||||
if engine_version["status"] != "stable":
|
||||
print("coreinit -> Error: CORE only supports Godot 4.1.stable releases.")
|
||||
return false
|
||||
# Display warning if autoloads are used
|
||||
if get_tree().root.get_child_count(true) != 2:
|
||||
print("coreinit -> Warning: We do not recommend using autoloads in your project as bugs may occur.")
|
||||
# Check if configuration file exists
|
||||
if !FileAccess.file_exists(loadpath + "config.gd"):
|
||||
print("coreinit -> Error: The CORE configuration file is missing. Use CORE Manager to repair your project.")
|
||||
return false
|
||||
# Success!
|
||||
return true
|
|
@ -1,13 +0,0 @@
|
|||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/coreinit.gd" id="1_ubktt"]
|
||||
|
||||
[node name="coreinit" type="Node"]
|
||||
script = ExtResource("1_ubktt")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_left = -5e+08
|
||||
offset_top = -5e+08
|
||||
offset_right = 5e+08
|
||||
offset_bottom = 5e+08
|
||||
color = Color(0, 0, 0, 1)
|
50
corelog.gd
50
corelog.gd
|
@ -1,50 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Initializes CORELog
|
||||
func initialize() -> void:
|
||||
if core.protection_mode: return
|
||||
# logevent (signal) -> logupdate()
|
||||
logger.connect("logevent",Callable(self,"logupdate"))
|
||||
|
||||
# Activate auto scrolling
|
||||
$Background/Log.scroll_active = true
|
||||
$Background/Log.scroll_following = true
|
||||
# Disable mouse influence
|
||||
$Background/Log.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
$Background/Log.get_child(0,true).mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
# Remove every VScrollBar style
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber_highlight",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("grabber_pressed",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("scroll",StyleBoxEmpty.new())
|
||||
$Background/Log.get_child(0,true).add_theme_stylebox_override("scroll_focus",StyleBoxEmpty.new())
|
||||
# Set VScollBar size to zero
|
||||
$Background/Log.get_child(0,true).set_deferred("size",Vector2i(0,0))
|
||||
|
||||
# Updates log text
|
||||
func logupdate(_type:String,_script:String,_method:String,logmessage:String) -> void:
|
||||
$Background/Log.text = $Background/Log.text + "\n" + logmessage
|
||||
|
||||
# These two functions are very self explanitory
|
||||
func display() -> void:
|
||||
if core.protection_mode: return
|
||||
$Background.visible = true
|
||||
|
||||
func dissolve() -> void:
|
||||
if core.protection_mode: return
|
||||
$Background.visible = false
|
52
corelog.tscn
52
corelog.tscn
|
@ -1,52 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/corelog.gd" id="1_8l1qi"]
|
||||
[ext_resource type="FontFile" path="res://CORE/hack.ttf" id="1_m5led"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_adeh8"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_koe3t"]
|
||||
|
||||
[node name="CORELog" 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_8l1qi")
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 540.0
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Log" type="RichTextLabel" parent="Background"]
|
||||
layout_mode = 0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 540.0
|
||||
theme_override_colors/default_color = Color(1, 1, 1, 1)
|
||||
theme_override_fonts/normal_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/bold_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/italics_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/bold_italics_font = ExtResource("1_m5led")
|
||||
theme_override_fonts/mono_font = ExtResource("1_m5led")
|
||||
theme_override_font_sizes/normal_font_size = 12
|
||||
theme_override_font_sizes/bold_font_size = 12
|
||||
theme_override_font_sizes/italics_font_size = 12
|
||||
theme_override_font_sizes/bold_italics_font_size = 12
|
||||
theme_override_font_sizes/mono_font_size = 12
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_adeh8")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_koe3t")
|
||||
bbcode_enabled = true
|
||||
text = "coreinit -> \"Fixing\" busy setting up children issue
|
||||
coreinit -> Bootstrapping CORE
|
||||
coreinit -> Checking CORE requirements
|
||||
coreinit -> Loading modules
|
||||
coreinit -> Constructing modules
|
||||
coreinit -> Injecting modules
|
||||
coreinit -> Updating dependency references
|
||||
coreinit -> Applying configuration to base modules
|
||||
coreinit -> Initializing base modules"
|
||||
scroll_following = true
|
|
@ -1,52 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ "$1" == "--help" ]; then
|
||||
echo "Environment variables: VERBOSE (false)"
|
||||
echo " FILEEXTENSION (*)"
|
||||
echo " IGNORE_SCRIPT (false)"
|
||||
echo " IGNORE_DOCUMENTATION (false)"
|
||||
echo " NUMBER_ONLY (false)"
|
||||
exit 0
|
||||
fi
|
||||
function dircount() {
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Checking directory \"$*\"..."; fi
|
||||
cd "$*" || exit 54
|
||||
for file in $FILEEXTENSION; do
|
||||
export "file_full=$*/$file"
|
||||
if [ -d "$file" ]; then
|
||||
if [ "$file" == "devprj" ]; then
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping directory \"devprj\"";fi
|
||||
else
|
||||
if [ "$IGNORE_DOCUMENTATION" == "true" ] && [ "$file" == "docs" ]; then
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping directory \"docs\"";fi
|
||||
else
|
||||
dircount "$file_full"
|
||||
fi
|
||||
fi
|
||||
elif [ -f "$file" ]; then
|
||||
if [ "$IGNORE_SCRIPT" == "true" ] && [ "$file" == "count_characters.sh" ]; then
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping this script"; fi
|
||||
else
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Counting characters in file \"$file_full\"..."; fi
|
||||
export "COUNT_FILE=$(wc -m < "$file_full")"
|
||||
export "COUNT=$((COUNT + COUNT_FILE))"
|
||||
fi
|
||||
else
|
||||
if [ "$VERBOSE" == "true" ]; then echo ":: Skipping \"$file_full\" (no file or directory)"; fi
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
}
|
||||
if [ "$FILEEXTENSION" == "" ]; then
|
||||
export "FILEEXTENSION=*"
|
||||
fi
|
||||
if [ "$*" == "" ]; then
|
||||
dircount "$(pwd)"
|
||||
else
|
||||
dircount "$(pwd)/$*"
|
||||
fi
|
||||
if [ "$VERBOSE" == "true" ]; then echo ""; fi
|
||||
if [ "$NUMBER_ONLY" == "true" ]; then
|
||||
echo "$COUNT"
|
||||
else
|
||||
echo "Characters counted: $COUNT"
|
||||
fi
|
|
@ -1,71 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var misc: Node = null
|
||||
|
||||
# Important nodes
|
||||
@onready
|
||||
var display: RichTextLabel = get_node("Display")
|
||||
|
||||
# Config
|
||||
var config_enabled: bool = false
|
||||
var config_fps: bool = false
|
||||
var config_delta: bool = false
|
||||
var config_rendertime: bool = false
|
||||
var config_memory: bool = false
|
||||
|
||||
# Check if enabled
|
||||
func _process(_delta) -> void:
|
||||
if config_enabled:
|
||||
update_display()
|
||||
display.visible = true
|
||||
else:
|
||||
display.visible = false
|
||||
|
||||
# Updates the display with useful information
|
||||
func update_display():
|
||||
var displaytext: String = ""
|
||||
var displaysize: int = 17
|
||||
# Get memory information
|
||||
var info_memory: Dictionary = OS.get_memory_info()
|
||||
if config_memory:
|
||||
info_memory.merge({"peak":OS.get_static_memory_peak_usage(),"percent":float(OS.get_static_memory_usage())/info_memory["physical"]*100,"used":OS.get_static_memory_usage()})
|
||||
|
||||
# If fps is enabled, add the fps counter
|
||||
if config_fps:
|
||||
displaysize = displaysize+17*1
|
||||
displaytext = displaytext + "\nFPS: " + str(snappedf(misc.get_fps(false),0.01))
|
||||
# If delta is enabled, add the delta counter
|
||||
if config_delta:
|
||||
displaysize = displaysize+17*1
|
||||
displaytext = displaytext + "\nDelta: " + str(misc.get_delta())
|
||||
# If rendertime is enabled, add the rendertime counter
|
||||
if config_rendertime:
|
||||
displaysize = displaysize+17*1
|
||||
displaytext = displaytext + "\nRendertime: " + str(misc.get_rendertime())
|
||||
# If memory is enabled, display memory information
|
||||
if config_memory:
|
||||
displaysize = displaysize+17*2
|
||||
displaytext = displaytext + "\nMemory (Available|Used|Stack): " + str(misc.byte_to_mib(info_memory["available"],true)) + " MiB|" + str(misc.byte_to_mib(info_memory["used"],true)) + " MiB|" + str(misc.byte_to_mib(info_memory["stack"],true)) + " MiB"
|
||||
displaytext = displaytext + "\nMemory (Physical|Peak|%): " + str(misc.byte_to_mib(info_memory["physical"],true)) + " MiB|" + str(misc.byte_to_mib(info_memory["peak"],true)) + " MiB|" + str(snappedf(info_memory["percent"],0.001)) + "%"
|
||||
|
||||
# Add CORE version and (if enabled) a dev mode notice
|
||||
if core.development_mode:
|
||||
displaytext = "CORE " + core.version["full"] + " [color=yellow](development mode)[/color]" + displaytext
|
||||
else:
|
||||
displaytext = "CORE " + core.version["full"] + displaytext
|
||||
# Update display
|
||||
display.text = displaytext
|
||||
display.size = Vector2i(540,displaysize)
|
|
@ -1,34 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/debugdisplay.gd" id="1_hcfi0"]
|
||||
[ext_resource type="FontFile" path="res://CORE/hack.ttf" id="1_nhdg1"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3c08d"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5ghow"]
|
||||
bg_color = Color(0.839216, 0.0196078, 0.196078, 0.862745)
|
||||
corner_radius_bottom_right = 16
|
||||
shadow_color = Color(0, 0, 0, 0)
|
||||
|
||||
[node name="DebugDisplay" type="Node"]
|
||||
script = ExtResource("1_hcfi0")
|
||||
|
||||
[node name="Display" type="RichTextLabel" parent="."]
|
||||
offset_right = 540.0
|
||||
offset_bottom = 102.0
|
||||
theme_override_colors/default_color = Color(1, 1, 1, 1)
|
||||
theme_override_fonts/normal_font = ExtResource("1_nhdg1")
|
||||
theme_override_font_sizes/normal_font_size = 14
|
||||
theme_override_font_sizes/bold_font_size = 14
|
||||
theme_override_font_sizes/italics_font_size = 14
|
||||
theme_override_font_sizes/bold_italics_font_size = 14
|
||||
theme_override_font_sizes/mono_font_size = 14
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_3c08d")
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_5ghow")
|
||||
bbcode_enabled = true
|
||||
text = "CORE source-N (development mode) (THIS IS A PLACEHOLDER!)
|
||||
FPS:
|
||||
Delta:
|
||||
Rendertime:
|
||||
Memory (1):
|
||||
Memory (2):"
|
BIN
dist/FiraCode/Bold.ttf
vendored
Normal file
BIN
dist/FiraCode/Bold.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Bold.ttf.import
vendored
Normal file
33
dist/FiraCode/Bold.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bvg3rkn8w7apl"
|
||||
path="res://.godot/imported/Bold.ttf-ab518348487b0af32a3bf04bad1329bc.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/static/dist/FiraCode/Bold.ttf"
|
||||
dest_files=["res://.godot/imported/Bold.ttf-ab518348487b0af32a3bf04bad1329bc.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Light.ttf
vendored
Normal file
BIN
dist/FiraCode/Light.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Light.ttf.import
vendored
Normal file
33
dist/FiraCode/Light.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bvluo6uibvwwo"
|
||||
path="res://.godot/imported/Light.ttf-ad4f5cc78f585b9feb8a0964e43f9ad0.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://dist/FiraCode/Light.ttf"
|
||||
dest_files=["res://.godot/imported/Light.ttf-ad4f5cc78f585b9feb8a0964e43f9ad0.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Medium.ttf
vendored
Normal file
BIN
dist/FiraCode/Medium.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Medium.ttf.import
vendored
Normal file
33
dist/FiraCode/Medium.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://b1pxod4r5puw8"
|
||||
path="res://.godot/imported/Medium.ttf-59b027cf923d1808848708fe911fbecd.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/static/dist/FiraCode/Medium.ttf"
|
||||
dest_files=["res://.godot/imported/Medium.ttf-59b027cf923d1808848708fe911fbecd.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Regular.ttf
vendored
Normal file
BIN
dist/FiraCode/Regular.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Regular.ttf.import
vendored
Normal file
33
dist/FiraCode/Regular.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dmyes0lwt4sgw"
|
||||
path="res://.godot/imported/Regular.ttf-2558edcdc38a3fc7826c41c3a4184518.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/static/dist/FiraCode/Regular.ttf"
|
||||
dest_files=["res://.godot/imported/Regular.ttf-2558edcdc38a3fc7826c41c3a4184518.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
dist/FiraCode/Retina.ttf
vendored
Normal file
BIN
dist/FiraCode/Retina.ttf
vendored
Normal file
Binary file not shown.
33
dist/FiraCode/Retina.ttf.import
vendored
Normal file
33
dist/FiraCode/Retina.ttf.import
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://c2qswgll1vpc6"
|
||||
path="res://.godot/imported/Retina.ttf-82d9e54633305cac0957f1b54d37c125.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://dist/FiraCode/Retina.ttf"
|
||||
dest_files=["res://.godot/imported/Retina.ttf-82d9e54633305cac0957f1b54d37c125.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
0
soscore.png → dist/core.png
vendored
0
soscore.png → dist/core.png
vendored
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
34
dist/core.png.import
vendored
Normal file
34
dist/core.png.import
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://o1vm4b2o5j6"
|
||||
path="res://.godot/imported/core.png-14d81fc9b3dc0a24eb68b48b67e98124.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://docs/static/dist/core.png"
|
||||
dest_files=["res://.godot/imported/core.png-14d81fc9b3dc0a24eb68b48b67e98124.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
dist/core.xcf
vendored
Normal file
BIN
dist/core.xcf
vendored
Normal file
Binary file not shown.
15
docs/.gitignore
vendored
Normal file
15
docs/.gitignore
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/node_modules
|
||||
/out
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
pnpm-lock.yaml
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
24
docs/Makefile
Normal file
24
docs/Makefile
Normal file
|
@ -0,0 +1,24 @@
|
|||
.PHONY: dist help
|
||||
|
||||
dist: help
|
||||
help:
|
||||
@echo "make install-deps -> Install all dependencies"
|
||||
@echo " test -> Start a web server for development"
|
||||
@echo " build -> Build static files"
|
||||
@echo " clean -> Clean directory"
|
||||
@echo " clean-extra -> Clean directory with extra directories/files"
|
||||
install-deps:
|
||||
pnpm install
|
||||
test:
|
||||
pnpm run start --hot-only --no-open
|
||||
build:
|
||||
pnpm run build --out-dir out
|
||||
clean:
|
||||
pnpm run clear
|
||||
rm -rf "out" ".docusaurus" ".cache-loader"
|
||||
clean-extra: clean
|
||||
rm -rf "node_modules" "pnpm-lock.yaml"
|
||||
|
||||
# The nuclear option. Why is it here you might ask? I made it while creating the documentation README.md
|
||||
clean-ultra: clean clean-extra
|
||||
rm -rf "~/.cache/pnpm" "~/.local/share/pnpm" "~/.local/state/pnpm"
|
116
docs/README.md
Normal file
116
docs/README.md
Normal file
|
@ -0,0 +1,116 @@
|
|||
# Presencode documentation
|
||||
The Presencode documentation uses [Docusaurus](https://docusaurus.io).
|
||||
|
||||
# Commands
|
||||
We use [make](https://www.gnu.org/software/make/).
|
||||
## Installing dependencies
|
||||
```plain
|
||||
$ make install-deps
|
||||
pnpm install
|
||||
Downloading registry.npmjs.org/typescript/5.2.2: 7,23 MB/7,23 MB, done
|
||||
WARN 1 deprecated subdependencies found: stable@0.1.8
|
||||
Packages: +1088
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
Progress: resolved 1089, reused 0, downloaded 1088, added 1088, done
|
||||
node_modules/.pnpm/core-js-pure@3.35.0/node_modules/core-js-pure: Running postinstall script, done in 92ms
|
||||
node_modules/.pnpm/core-js@3.35.0/node_modules/core-js: Running postinstall script, done in 92ms
|
||||
|
||||
dependencies:
|
||||
+ @docusaurus/core 3.1.0
|
||||
+ @docusaurus/plugin-content-docs 3.1.0
|
||||
+ @docusaurus/plugin-sitemap 3.1.0
|
||||
+ @docusaurus/preset-classic 3.1.0
|
||||
+ @mdx-js/react 3.0.0
|
||||
+ clsx 2.1.0
|
||||
+ prism-react-renderer 2.3.1
|
||||
+ react 18.2.0
|
||||
+ react-dom 18.2.0
|
||||
|
||||
devDependencies:
|
||||
+ @docusaurus/module-type-aliases 3.1.0
|
||||
+ @docusaurus/tsconfig 3.1.0
|
||||
+ @docusaurus/types 3.1.0
|
||||
+ typescript 5.2.2 (5.3.3 is available)
|
||||
|
||||
Done in 18.1s
|
||||
```
|
||||
## Development web server
|
||||
This will start [a development server](http://localhost:3000) that supports hot reloading.
|
||||
```plain
|
||||
$ make test
|
||||
pnpm run start --hot-only --no-open
|
||||
|
||||
> docs@0.0.0 start /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
|
||||
> docusaurus start "--hot-only" "--no-open"
|
||||
|
||||
(node:138150) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
|
||||
(Use `node --trace-deprecation ...` to show where the warning was created)
|
||||
[INFO] Starting the development server...
|
||||
[SUCCESS] Docusaurus website is running at: http://localhost:3000/
|
||||
|
||||
✔ Client
|
||||
Compiled successfully in 4.40s
|
||||
|
||||
client (webpack 5.89.0) compiled successfully
|
||||
```
|
||||
## Building the documentation
|
||||
This will output the built documentation to `out/`. Simply point a web server to it and you're done.
|
||||
```plain
|
||||
$ make build
|
||||
pnpm run build --out-dir out
|
||||
|
||||
> docs@0.0.0 build /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
|
||||
> docusaurus build "--out-dir" "out"
|
||||
|
||||
(node:139592) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
|
||||
(Use `node --trace-deprecation ...` to show where the warning was created)
|
||||
[INFO] [en] Creating an optimized production build...
|
||||
|
||||
|
||||
✔ Client
|
||||
|
||||
|
||||
✔ Server
|
||||
Compiled successfully in 11.36s
|
||||
|
||||
|
||||
✔ Client
|
||||
|
||||
|
||||
● Server █████████████████████████ cache (99%) shutdown IdleFileCachePlugin
|
||||
stored
|
||||
|
||||
[SUCCESS] Generated static files in "out".
|
||||
[INFO] Use `npm run serve` command to test your build locally
|
||||
```
|
||||
## Cleaning the directory
|
||||
This will remove the `out/` directory containing the built website aswell as Docusaurus files.
|
||||
```plain
|
||||
$ make clean
|
||||
pnpm run clear
|
||||
|
||||
> docs@0.0.0 clear /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
|
||||
> docusaurus clear
|
||||
|
||||
(node:140318) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
|
||||
(Use `node --trace-deprecation ...` to show where the warning was created)
|
||||
[SUCCESS] Removed the generated folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/.docusaurus".
|
||||
[SUCCESS] Removed the Webpack persistent cache folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/node_modules/.cache".
|
||||
rm -rf "out" ".docusaurus" ".cache-loader"
|
||||
```
|
||||
### More cleaning
|
||||
This will remove the `node_modules/` and `pnpm-lock.yaml` directory aswell.
|
||||
```plain
|
||||
$ make clean-extra
|
||||
pnpm run clear
|
||||
|
||||
> docs@0.0.0 clear /home/jeremystartm/Code/JeremyStarTM/Presencode/docs
|
||||
> docusaurus clear
|
||||
|
||||
(node:141571) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
|
||||
(Use `node --trace-deprecation ...` to show where the warning was created)
|
||||
[SUCCESS] Removed the generated folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/.docusaurus".
|
||||
[SUCCESS] Removed the Webpack persistent cache folder at "/home/jeremystartm/Code/JeremyStarTM/Presencode/docs/node_modules/.cache".
|
||||
rm -rf "out" ".docusaurus" ".cache-loader"
|
||||
rm -rf "node_modules" "pnpm-lock.yaml"
|
||||
```
|
3
docs/babel.config.js
Normal file
3
docs/babel.config.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Breaking commits
|
||||
We sometimes push a commit that may break something for some project. Here's where we list critical changes.
|
||||
|
||||
## 404 Documentation not found
|
||||
There are no breaking commits as of now.
|
19
docs/docs/about.md
Normal file
19
docs/docs/about.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# About the CORE Framework
|
||||
The CORE Framework aims at simplifying development for developers writing their code in the [Godot Engine](https://godotengine.org), version *4.2*.
|
||||
|
||||
## Why does it exist?
|
||||
I ([JeremyStarTM](https://jstm.staropensource.de)) didn't want to write a new base every time I started another project. And that's why I made the CORE Framework, to serve as a common base for all my projects.
|
||||
|
||||
## Should I use it?
|
||||
If you want to use the CORE Framework in a new project, then your answer is **yes**! If you want to use the CORE Framework in an already existing project, be prepared to do some major refactoring. CORE implements it's own logging infrastructure, scene management, etc. and is not compatible with Godot's builtin/custom solutions. You can toggle them in the configuration file however.
|
||||
|
||||
## Roadmap
|
||||
- [x] Configuration support
|
||||
- [x] Logger implementation
|
||||
- [ ] HTTP Request helper
|
||||
- [ ] Mod Loader
|
||||
- [ ] Support for custom modules
|
8
docs/docs/reference/_category_.json
Normal file
8
docs/docs/reference/_category_.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"label": "Reference",
|
||||
"position": 3,
|
||||
"link": {
|
||||
"type": "generated-index",
|
||||
"description": "Documentation about CORE's internals"
|
||||
}
|
||||
}
|
8
docs/docs/reference/api/_category_.json
Normal file
8
docs/docs/reference/api/_category_.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"label": "API",
|
||||
"position": 1,
|
||||
"link": {
|
||||
"type": "generated-index",
|
||||
"description": "CORE Framework module documentation"
|
||||
}
|
||||
}
|
55
docs/docs/reference/api/core.md
Normal file
55
docs/docs/reference/api/core.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# `CORE`
|
||||
The **CORE Object** is the class you use to initialize the CORE Framework.
|
||||
|
||||
## Constants
|
||||
### *int* <u>version_release</u>
|
||||
CORE's release number
|
||||
### *CoreTypes.VersionType* <u>version_type</u>
|
||||
CORE's release type. See [`CoreTypes.VersionType`](/reference/api/coretypes#versiontype) for more information.
|
||||
### *int* <u>version_typerelease</u>
|
||||
CORE's typerelease number
|
||||
|
||||
## Modules
|
||||
Use these to access CORE's modules.
|
||||
- `config` (**NEVER access this yourself. To change the configuration, use [`reload_configuration()`](#void-reload_configurationcoreconfiguration-new_config) instead**)
|
||||
- `logger`
|
||||
- `misc`
|
||||
- `logui` (not important for developers, displays the log graphically)
|
||||
|
||||
## Variables
|
||||
### *String* <u>basepath</u>
|
||||
Stores the path to CORE's installation directory.
|
||||
|
||||
## Functions
|
||||
### *void* <u>_init</u>(*CoreConfiguration* <u>new_config</u>)
|
||||
:::note
|
||||
This function will be called when calling `CORE.new()`.
|
||||
:::
|
||||
Determines the base path, loads the configuration file and initializes all modules.
|
||||
### *void* <u>reload_configuration</u>(*CoreConfiguration* <u>new_config</u>)
|
||||
Loads a new CoreConfiguration class and applies it's settings.
|
||||
### *bool* <u>is_devmode</u>()
|
||||
Returns the development mode status.
|
||||
### *String* <u>get_format_string</u>(*String* <u>string</u>)
|
||||
Replaces placeholders with human-friendly strings
|
||||
You can use the following placeholders:
|
||||
- `%release%`
|
||||
Returns the release number.
|
||||
- `%release_type%`
|
||||
Returns the typerelease number
|
||||
- `%release_semantic%`
|
||||
Returns the result of [`get_version_semantic()`](#arrayint-get_version_semantic), example *5.2.3*
|
||||
- `%type%`
|
||||
Returns the release type as a word, for example *Release Candidate*
|
||||
- `%type_technical%`
|
||||
Returns the release type as one or two lowercase letters, for example *rc*
|
||||
- `%devmode%`
|
||||
Returns the development mode status
|
||||
- `%headless%`
|
||||
Returns the headless mode status
|
||||
### *Array[int]* <u>get_version_semantic</u>()
|
||||
Returns the CORE version in the semantic versioning scheme. The first integer contains the release number, the second integer contains the release type (0 for beta, 1 for alpha, 2 for rc and 3 for release) and the last integer contains the typerelease number.
|
40
docs/docs/reference/api/coreconfiguration.md
Normal file
40
docs/docs/reference/api/coreconfiguration.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# `CoreConfiguration`
|
||||
Provides the default configuration for the CORE Framework.
|
||||
|
||||
## Variables
|
||||
### *bool* <u>headless</u> = *false*
|
||||
Controls CORE's functionality. Renders GUI-related modules useless when set to `true`, which is the recommended behaviour on servers. For CORE's full functionality, set this to `true`.
|
||||
### *bool* <u>debug_allow</u> = *false*
|
||||
:::note
|
||||
This will not enable the development mode automatically, only if you're developing on CORE itself.
|
||||
:::
|
||||
Allows debugging functionality if set to `true`, or not if set to `false`.
|
||||
### *CoreTypes.LoggerLevel* <u>logger_level</u> = *CoreTypes.LoggerLevel.INFO*
|
||||
I don't have to explain this, do I?
|
||||
### *bool* <u>logger_colored</u> = *true*
|
||||
Toggles colored output. Set to `false` if you don't want that.
|
||||
### *String* <u>logger_format</u> = *"%color%[%time%] [%level% %source%:%line%] %message%"*
|
||||
The format string the logger will operate on.
|
||||
Available placeholders are: `%time%`, `%time_ms%`, `%level%`, `%color%`, `%message%`, `%source%`, `%source_raw%`, `%function%` and `%line%`
|
||||
### *bool* <u>logger_newlines_override</u> = *true*
|
||||
This example should make it clear, what this does:
|
||||
```plain
|
||||
logger_newlines_override = true:
|
||||
[09:47:00] [INFO Test.gd:69] This is a test message...
|
||||
with a newline!
|
||||
logger_newlines_override = false:
|
||||
[09:47:00] [INFO Test.gd:69] This is a test message...
|
||||
with a newline!
|
||||
```
|
||||
### *int* <u>logger_newlines_sizelimit</u> = *40*
|
||||
The maximum amount of characters than can appear before `%message%` before newlines won't be overriden. Settiing this variable to `-1` disables this behaviour.
|
||||
### *bool* <u>logui_background</u> = *true*
|
||||
Determines if the [`LogUI`](/reference/terminology#logui)'s (by default) black background should be visible.
|
||||
### *Color* <u>logui_background_color</u> = *Color.BLACK*
|
||||
The color the `LogUI` background will have.
|
||||
### *int* <u>logui_font_size</u> = *14*
|
||||
The font size the graphical log output should have.
|
12
docs/docs/reference/api/coretypes.md
Normal file
12
docs/docs/reference/api/coretypes.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# `CoreTypes`
|
||||
Contains globaly accessible custom enums and types used throughout the CORE Framework's source code.
|
||||
|
||||
## Enums
|
||||
### <u>VersionType</u>
|
||||
RELEASE, RELEASECANDIDATE, BETA, ALPHA
|
||||
### <u>LoggerLevel</u>
|
||||
NONE, ERROR, WARN, INFO, VERB, DIAG
|
33
docs/docs/reference/api/logger.md
Normal file
33
docs/docs/reference/api/logger.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# `Logger`
|
||||
Prints formatted strings into the console/log.
|
||||
|
||||
## Signals
|
||||
### <u>log_event</u>
|
||||
- Signature: *bool* <u>allowed</u>, *CoreTypes.LoggerLevel* <u>level</u>, *Dictionary* <u>origin</u>, *String* <u>message</u>, *String* <u>format</u> \
|
||||
|
||||
Emitted on any log call, permitted or not. \
|
||||
**origin** contains the keys `source`, `source_clean`, `function` and `line`. \
|
||||
**format** is set to `""` when **allowed** is set `false`.
|
||||
|
||||
## Functions
|
||||
### *bool* <u>is_level_allowed</u>(*CoreTypes.LoggerLevel* <u>level</u>)
|
||||
Checks if the specified log level is permitted by the current configuration.
|
||||
### *void* <u>diag</u>(*String* <u>message</u>)
|
||||
Prints a diagnostic message
|
||||
### *void* <u>verb</u>(*String* <u>message</u>)
|
||||
Prints a verbose message
|
||||
### *void* <u>info</u>(*String* <u>message</u>)
|
||||
Prints a informational message
|
||||
### *void* <u>warn</u>(*String* <u>message</u>)
|
||||
Prints a warning message
|
||||
### *void* <u>error</u>(*String* <u>message</u>)
|
||||
Prints an error message
|
||||
### *void* <u>crash</u>(*String* <u>message</u>)
|
||||
:::note[Awaiting required]
|
||||
Using the `await` keyword is required for this function.
|
||||
:::
|
||||
Handles crashes. Will terminate your game/application immediately.
|
13
docs/docs/reference/api/misc.md
Normal file
13
docs/docs/reference/api/misc.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# `Miscellaneous`
|
||||
Miscellaneous functions that don't fit into other modules.
|
||||
|
||||
## Functions
|
||||
### *void* <u>quit_safely</u>(*int* <u>exitcode</u> = *0*)
|
||||
:::note[Awaiting required]
|
||||
Using the `await` keyword is required for this function.
|
||||
:::
|
||||
Adds an small extra delay before exiting. Highly recommended over calling `get_tree().quit()` yourself.
|
11
docs/docs/reference/terminology.md
Normal file
11
docs/docs/reference/terminology.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Terminology
|
||||
You don't know a word? Look it up here.
|
||||
|
||||
## CORE Object aka. `CORE`
|
||||
The **CORE Object** is the class you use to initialize the CORE Framework.
|
||||
## `LogUI`
|
||||
Displays the log/console output graphically in the background.
|
127
docs/docusaurus.config.ts
Normal file
127
docs/docusaurus.config.ts
Normal file
|
@ -0,0 +1,127 @@
|
|||
import {themes as prismThemes} from "prism-react-renderer";
|
||||
import type {Config} from "@docusaurus/types";
|
||||
import type * as Preset from "@docusaurus/preset-classic";
|
||||
|
||||
const config: Config = {
|
||||
title: "CORE Framework",
|
||||
url: "https://core.jstm.staropensource.de",
|
||||
baseUrl: "/",
|
||||
|
||||
favicon: "dist/core.png",
|
||||
trailingSlash: true,
|
||||
i18n: {
|
||||
defaultLocale: "en",
|
||||
locales: ["en"],
|
||||
},
|
||||
noIndex: false,
|
||||
onBrokenLinks: "throw",
|
||||
onBrokenAnchors: "throw",
|
||||
onBrokenMarkdownLinks: "throw",
|
||||
onDuplicateRoutes: "warn",
|
||||
/*
|
||||
onBrokenLinks: "ignore",
|
||||
onBrokenAnchors: "ignore",
|
||||
onBrokenMarkdownLinks: "ignore",
|
||||
onDuplicateRoutes: "ignore",
|
||||
*/
|
||||
tagline: "// TODO",
|
||||
|
||||
themeConfig: {
|
||||
docs: {
|
||||
sidebar: {
|
||||
hideable: false,
|
||||
autoCollapseCategories: true,
|
||||
}
|
||||
},
|
||||
navbar: {
|
||||
title: "CORE Framework",
|
||||
logo: {
|
||||
alt: "CORE Framework",
|
||||
src: "dist/core.png",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "docSidebar",
|
||||
sidebarId: "sidebar",
|
||||
position: "left",
|
||||
label: "Documentation",
|
||||
},
|
||||
{
|
||||
href: "https://git.staropensource.de/StarOpenSource/CORE",
|
||||
label: "Source code",
|
||||
position: "right",
|
||||
},
|
||||
],
|
||||
},
|
||||
footer: {
|
||||
style: "dark",
|
||||
copyright: `Copyright (c) ${new Date().getFullYear()} The StarOpenSource Project & Contributors<br/>Licensed under the GNU General Public License version 3`,
|
||||
},
|
||||
prism: {
|
||||
theme: prismThemes.github,
|
||||
darkTheme: prismThemes.dracula,
|
||||
},
|
||||
} satisfies Preset.ThemeConfig,
|
||||
|
||||
presets: [
|
||||
[
|
||||
"classic",
|
||||
{
|
||||
debug: false,
|
||||
|
||||
docs: {
|
||||
path:
|
||||
"docs",
|
||||
editUrl: "https://git.staropensource.de/StarOpenSource/CORE/_edit/develop/docs/",
|
||||
editLocalizedFiles: false,
|
||||
editCurrentVersion: true,
|
||||
routeBasePath: "",
|
||||
tagsBasePath: 'tags',
|
||||
sidebarPath: "./sidebars.ts",
|
||||
sidebarCollapsible: false,
|
||||
sidebarCollapsed: false,
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
breadcrumbs: true,
|
||||
includeCurrentVersion: true,
|
||||
|
||||
},
|
||||
sitemap: {
|
||||
changefreq: "monthly",
|
||||
priority: 0.5,
|
||||
filename: "sitemap.xml"
|
||||
|
||||
},
|
||||
theme: {
|
||||
customCss: "./src/css/custom.css",
|
||||
},
|
||||
} satisfies Preset.Options,
|
||||
],
|
||||
],
|
||||
|
||||
plugins: [
|
||||
[
|
||||
"@docusaurus/plugin-client-redirects",
|
||||
{
|
||||
fromExtensions: ["html", "htm", "php"],
|
||||
redirects: [
|
||||
{
|
||||
from: ["/", "/index"],
|
||||
to: "/about",
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
],
|
||||
|
||||
markdown: {
|
||||
format: "md",
|
||||
mermaid: false,
|
||||
},
|
||||
|
||||
staticDirectories: ["static"],
|
||||
titleDelimiter: "»",
|
||||
baseUrlIssueBanner: true,
|
||||
};
|
||||
|
||||
export default config;
|
BIN
docs/favicon.png
BIN
docs/favicon.png
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB |
|
@ -1,27 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Home
|
||||
Welcome to the StarOpenSource documentation! Look below for more information about CORE and code references.
|
||||
|
||||
## What, why, wtf?
|
||||
The **StarOpenSource CORE Framework** (also known as **CORE** or **SOSCORE**) is a framework that makes the development of games and applications written in **Godot 4.1** easier. CORE implements useful & common functions *(such as calculating the current FPS)* and provides a logging system that even supports formatting, a scene manager and so much more.
|
||||
|
||||
## Can I use CORE in my existing project?
|
||||
Yes, unless you want to refactor your entire project. Remember: CORE is a framework, NOT a library and NOT a regular addon!
|
||||
|
||||
## Can I use CORE in my project freely?
|
||||
[Click this text to learn more about licensing.](/licensing/)
|
||||
|
||||
## I have a problem with CORE!
|
||||
First of all, read the [Troubleshooting guide](/troubleshooting/). If you can't find your error in there or CORE has a compatibility issue with some addon, look at [the issue tracker](https://git.staropensource.de/StarOpenSource/issues) for more information.
|
||||
|
||||
## How to install/update CORE?
|
||||
If you want to install CORE, follow [this guide](/install/). If you want to update CORE to the latest version instead, follow [this guide](/update/) instead.
|
||||
|
||||
## Where are the code references?
|
||||
Look at the [reference index](/references/) for a list of all available methods and variables.
|
||||
|
||||
## How can I contact you?
|
||||
You can contact us by either writing a post in the fediverse and mentioning **[@soscore@net.staropensource.de](https://net.staropensource.de/@soscore)** or writing a email at **[support@staropensource.de](mailto:support@staropensource.de)**
|
133
docs/install.md
133
docs/install.md
|
@ -1,133 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Installing CORE
|
||||
## The safe route
|
||||
### Step 1: Downloading the *CORE Manager*
|
||||
Before we install CORE, we first have to download the **CORE Manager**. It is responsible for installing CORE and downloading updates.<br/>
|
||||
#### Windows: [CORE-Manager.exe](https://git.staropensource.de/staropensource/core-manager/releases/download/b1/CORE-Manager.exe)
|
||||
#### Linux: [CORE-Manager.elf](https://git.staropensource.de/staropensource/core-manager/releases/download/b1/CORE-Manager.elf)
|
||||
#### macOS: Use `wine` to run `CORE-Manager.exe`
|
||||
|
||||
### Step 2: Using the *CORE Manager*
|
||||
Launch `CORE-Manager.exe` or `CORE-Manager.elf` and type in the path to your Godot project ***(replace backslashes with regular slashes on Windows)***. Click on `Install` and wait until it's finished.
|
||||
|
||||
**Note: If you are updating CORE, click on `Update` instead.**
|
||||
|
||||
### Step 3: Configuring your project
|
||||
Launch your project in the Godot Editor and go to your project settings. You now need to set your startup scene to `res://CORE/coreinit.tscn`.
|
||||
|
||||
### Step 4: Write your init script
|
||||
Create a new GDScript file at `res://init.gd` (can be anything else, but you need to change the `core_initscript` variable accordingly!) and write this into it:
|
||||
```gdscript
|
||||
extends Node
|
||||
|
||||
@onready
|
||||
var core = get_node("/root/CORE") #(1)!
|
||||
@onready
|
||||
var logger = core.get_module("Logger") #(2)!
|
||||
|
||||
func _ready() -> void:
|
||||
core.welcome() #(3)!
|
||||
config.logger_diagnostic = true #(4)!
|
||||
core.reload_config() #(5)!
|
||||
logger.diag("<your_script_name>","This is a diagnostic message. I can only be seen if diagnostic log messages are enabled.")
|
||||
logger.info("<your_script_name>","This is a informational message.")
|
||||
logger.warn("<your_script_name>","This is a warning message.")
|
||||
logger.error("<your_script_name>","This is a error message.")
|
||||
core.exit_safely() #(6)!
|
||||
```
|
||||
|
||||
1. Imports the CORE "module" aka. /root/CORE
|
||||
2. Imports the CORE's logger implementation
|
||||
3. Makes CORE say hello :)
|
||||
4. Overwrites the logger_diagnostic setting temporarily (in memory)
|
||||
5. Applies all modified settings
|
||||
6. Tells CORE to shutdown your application safely. Has to do with CORE's logger and Godot.
|
||||
|
||||
Now replace `<your_script_name>` with the file path of your script (preferably with `.gd` and without `res://`) and save it under the path you specified in the `core_initscript` variable.
|
||||
|
||||
### Step 5: Start your project
|
||||
Start your project and wait at least 500ms. You should see this output in your Godot console (with a few variations, of course):
|
||||
```text
|
||||
coreinit -> "Fixing" busy setting up children issue #(1)!
|
||||
coreinit -> Bootstrapping CORE
|
||||
coreinit -> Checking CORE requirements
|
||||
coreinit -> Loading modules
|
||||
coreinit -> Constructing modules
|
||||
coreinit -> Injecting modules
|
||||
coreinit -> Updating dependency references
|
||||
coreinit -> Applying configuration to base modules
|
||||
coreinit -> Initializing base modules
|
||||
(CORE/core.gd) [INFO] CORE (source 0) welcomes you! #(2)!
|
||||
It seems like everything is working :)
|
||||
(init.gd) [DIAG] This is a diagnostic message. I can only be seen if diagnostic log messages are enabled.
|
||||
(init.gd) [INFO] This is a informational message.
|
||||
(init.gd) [WARN] This is a warning message.
|
||||
(init.gd) [ERR!] This is a error message.
|
||||
(CORE/coreinit.gd) [DIAG] Bootstrapped CORE, exiting. #(3)!
|
||||
```
|
||||
|
||||
1. These messages are printed anyway as CORE's logger implementation is not loaded at that point in time
|
||||
2. That log messages comes from your init.gd!
|
||||
3. tldr we enabled diagnostic messages "too fast". if we delayed the config reload by half a second, we wouldn't have seen that message.
|
||||
|
||||
If your project returns about the same output then CORE has been successfully installed. If not, look for your error [here](/troubleshooting/). For a quick start guide, [click here](/quickstartguide/)
|
||||
|
||||
## YOLOing the install
|
||||
Do you want to play with fire? Do you like to live at the edge of what's possible? Or are you just a Arch Linux or Gentoo user? If yes, here's a guide on how to manually install and update CORE.
|
||||
|
||||
### Note
|
||||
This install method is **only recommended for devs experienced with CORE, Godot 4 and Git**. We are not responsible if you mess up something and break your project!
|
||||
|
||||
### Installing CORE
|
||||
1. Create your Godot Project and open the project folder in a terminal
|
||||
2. Execute `git clone https://git.staropensource.de/StarOpenSource/core.git CORE` (even if you're planning/using a git repository already! Do NOT use git submodules!)
|
||||
3. `cd` into the CORE folder and copy `config.gd.example` and rename it to `config.gd`. You may edit it to your liking now.
|
||||
4. Create your init script at `[project root]/init.gd` (or some other path, update it in `config.gd` accordingly) and write this into it:
|
||||
```gdscript
|
||||
extends Node
|
||||
|
||||
@onready
|
||||
var core = get_node("/root/CORE")
|
||||
@onready
|
||||
var logger = core.get_module("Logger")
|
||||
|
||||
func _ready() -> void:
|
||||
logger.info("init.gd","init.gd loaded.")
|
||||
core.welcome()
|
||||
core.exit_safely()
|
||||
```
|
||||
5. Go back to Godot and set your startup scene to `res://CORE/coreinit.tscn`
|
||||
6. Launch your project, you should see something like this in your console:
|
||||
```text
|
||||
coreinit -> "Fixing" busy setting up children issue
|
||||
coreinit -> Bootstrapping CORE
|
||||
coreinit -> Checking CORE requirements
|
||||
coreinit -> Loading modules
|
||||
coreinit -> Constructing modules
|
||||
coreinit -> Injecting modules
|
||||
coreinit -> Updating dependency references
|
||||
coreinit -> Applying configuration to base modules
|
||||
coreinit -> Initializing base modules
|
||||
(init.gd) [INFO] init.gd loaded.
|
||||
(CORE/core.gd) [INFO] CORE (source 0) welcomes you!
|
||||
It seems like everything is working :)
|
||||
(CORE/coreinit.gd) [DIAG] Bootstrapped CORE, exiting.
|
||||
```
|
||||
7. Congrats, you're not a idiot.
|
||||
|
||||
### Updating CORE
|
||||
1. Open your Godot project folder in a terminal
|
||||
2. `cd` into the CORE folder and create a backup of your `config.gd` file
|
||||
3. Run `git pull`
|
||||
4. Check the [breaking commits](/breaking-commits/) documentation page for breaking changes and update your code accordingly
|
||||
5. Launch your project and look for any issues. If any arise re-check your code for any [breaking commits](/breaking-commits/) or contact us.
|
||||
|
||||
### Reverting a update
|
||||
#### Reverting an update is unsupported and should **only** be used in special cases.
|
||||
1. Open your Godot project folder in a terminal
|
||||
2. `cd` into the CORE folder and create a backup of your `config.gd` file
|
||||
3. Run `git fetch && git checkout <COMMIT>` (replace `<COMMIT>` with whatever commit you want to revert to)
|
||||
4. Revert all changes made in all commits after. Checking the [breaking commits](/breaking-commits/) page might be useful.
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Licensing
|
||||
## Disclaimer
|
||||
This documentation page only covers the most important licensing question. If you want to read more about the GNU General Public License Version 3, [read this](https://www.gnu.org/licenses/gpl-faq.html).
|
||||
|
||||
## Note
|
||||
Under a **modified CORE copy** we understand a CORE installation that has been modified in any way. The configuration file `config.gd` is excluded.
|
||||
|
||||
## What happens when the license is violated against?
|
||||
We'll contact the person/organisation doing that. If they won't take it down or can't be contacted, we'll send a cease and desist letter or contact a lawyer.
|
||||
|
||||
## Can I use CORE inside of my proprietary application or game?
|
||||
No, you are not allowed to do that. Your project must be open source. [Read more...](https://www.gnu.org/licenses/gpl-faq.html#GPLInProprietarySystem)
|
||||
|
||||
## Do I need to publish a modified CORE copy?
|
||||
If your project is private, no. But if you are publishing or sharing a application/game that uses a modified CORE copy, **you are required** to publish the modified CORE code under the GNU General Public License v3. [Read more...](https://www.gnu.org/licenses/gpl-faq.html#GPLRequireSourcePostedPublic)
|
||||
|
||||
## Can I change the license of my CORE fork?
|
||||
No, you can't. You are not allowed to do that. [Read more...](https://www.gnu.org/licenses/gpl-faq.html#HeardOtherLicense)
|
||||
|
||||
## Can I sell my CORE fork?
|
||||
Yes, but you are required to publish the source code under the GNU General Public License version 3. [Read more...](https://www.gnu.org/licenses/gpl-faq.html#GPLCommercially)
|
14636
docs/package-lock.json
generated
Normal file
14636
docs/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
51
docs/package.json
Normal file
51
docs/package.json
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "docs",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.1.1",
|
||||
"@docusaurus/plugin-client-redirects": "^3.1.1",
|
||||
"@docusaurus/plugin-content-docs": "^3.1.1",
|
||||
"@docusaurus/plugin-sitemap": "^3.1.1",
|
||||
"@docusaurus/preset-classic": "3.1.1",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.1.1",
|
||||
"@docusaurus/tsconfig": "3.1.1",
|
||||
"@docusaurus/types": "3.1.1",
|
||||
"@types/node": "^20.11.0",
|
||||
"typescript": "~5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 3 chrome version",
|
||||
"last 3 firefox version",
|
||||
"last 5 safari version"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0"
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# 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](/install/)
|
||||
|
||||
## 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:
|
||||
```gdscript
|
||||
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)!
|
||||
```
|
||||
|
||||
1. Imports the config module for configuration access
|
||||
2. Will be hidden unless logger_diagnostic is set to true permanently
|
||||
3. Overwrites the configuration setting "logger_diagnostic" in memory
|
||||
4. Tells CORE to apply config changes
|
||||
5. 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()
|
||||
```
|
|
@ -1,57 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# CORE (/root/CORE)
|
||||
The main "module"
|
||||
|
||||
## Constants
|
||||
### version
|
||||
- type `Dictionary`
|
||||
- description `The CORE version. "type" is the release type, "releasebuild" the number of the latest release and "full" the full version string.`
|
||||
- keys `type` (`String`, either `source`, `release` or `prerelease`), `releasebuild` (`int`) and `full` (`String`)
|
||||
|
||||
## Enums
|
||||
### Errors
|
||||
- description `Contains all possible errors CORE can throw at you.`
|
||||
- keys `OK`, `CORE_PROTECTIONMODE`, `CORE_EXCEPTION`, `CORE_INVALID_MODULE`, `RESOURCEMANAGER_ALREADY_EXISTS`, `RESOURCEMANAGER_RESOURCE_MISSING`, `RESOURCEMANAGER_BATCH_EMPTY`, `SCENEMANAGER_ALREADY_LOADED`, `SCENEMANAGER_NOT_LOADED` and `SCENEMANAGER_NOT_PACKEDSCENE`
|
||||
|
||||
## Methods
|
||||
### welcome()
|
||||
- returns `void`
|
||||
- description `Prints a welcome message and the CORE version.`
|
||||
### reload_config()
|
||||
- returns `void`
|
||||
- description `Reloads the configuration file and applies any changes (made in memory).`
|
||||
### get_module()
|
||||
- returns `Node`
|
||||
- description `Returns a CORE module. A alternative to get_node("/root/CORE/<module>")`
|
||||
- argument `module_name`
|
||||
- type `StringName`
|
||||
- mandatory `yes`
|
||||
- description `The CORE module that should be returned`
|
||||
- possible values `Config`, `Preprocessor`, `Logger`, `Miscellaneous`, `DebugDisplay`, `SplashScreen`, `ResourceManager`, `SceneManager` and `Events`
|
||||
- example
|
||||
```gdscript
|
||||
extends Node
|
||||
|
||||
@onready
|
||||
var core = get_node("/root/CORE")
|
||||
@onready
|
||||
var logger = core.get_module("Logger")
|
||||
|
||||
func _ready() -> void:
|
||||
logger.info("test.gd","Hi there!")
|
||||
```
|
||||
### devmode()
|
||||
- returns `void`
|
||||
- description `Enables the development mode`
|
||||
- note `Do not call this function unless you're working on CORE. It disables limits and many more things.`
|
||||
### exit_safely()
|
||||
- returns `void`
|
||||
- description `Exists CORE safely. Is recommended over get_tree().quit() as log messages may be stuck in processing and would get lost otherwise.`
|
||||
- argument `exitcode`
|
||||
- type `int`
|
||||
- description `Oh, you don't know what an exitcode is? Learn cmd.exe or bash you fool!`
|
||||
- mandatory `no, default value is 0`
|
||||
- trivia `The only thing this method does is to enable CORE's protection mode, wait 500ms (0.5s) and then quit.`
|
|
@ -1,143 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Configuration File (/root/CORE/Config)
|
||||
The CORE configuration file is located at `res://CORE/config.gd` and is used for configuring CORE behaviour. A full example configuration can be found [here](#example-configuration).
|
||||
|
||||
## Placeholders
|
||||
### [LOADPATH]
|
||||
- type `String`
|
||||
- description `Will be replaced by CORE's loadpath`
|
||||
- example `res://CORE/`
|
||||
- can be used in `splash_image`
|
||||
|
||||
## CORE
|
||||
### core_initscript
|
||||
- type `String`
|
||||
- description `The path to your init script`
|
||||
- default value `"res://init.gd"`
|
||||
|
||||
## Preprocessor
|
||||
### preprocessor_enabled
|
||||
- type `bool`
|
||||
- description `Enables the preprocessor if true`
|
||||
- default value `true`
|
||||
### preprocessor_diagnostic
|
||||
- type `bool`
|
||||
- description `Makes the preprocessor super-verbose`
|
||||
- default value `false`
|
||||
- note `Please leave this option disabled as your log will get massively bloated by the preprocessor.`
|
||||
|
||||
## Logger
|
||||
### logger_enabled
|
||||
- type `bool`
|
||||
- description `Enables CORE's logger implementation if true`
|
||||
- default value `true`
|
||||
### logger_diagnostic
|
||||
- type `bool`
|
||||
- description `Displays diagnostic messages including messages by CORE if enabled.
|
||||
- default value `false`
|
||||
|
||||
## CORELog
|
||||
### corelog_enabled
|
||||
- type `bool`
|
||||
- description `If CORELog should be displayed or not`
|
||||
- default value `true`
|
||||
|
||||
## Debug Display
|
||||
### debugdisplay_enabled
|
||||
- type `bool`
|
||||
- description `If the debug display should be enabled or not`
|
||||
- default value `false`
|
||||
### debugdisplay_fps
|
||||
- type `bool`
|
||||
- description `Displays the framerate counter if true`
|
||||
- default value `true`
|
||||
### debugdisplay_delta
|
||||
- type `bool`
|
||||
- description `Renders the delta value if true`
|
||||
- default value `true`
|
||||
### debugdisplay_rendertime
|
||||
- type `bool`
|
||||
- description `Displays the rendertime if true`
|
||||
- default value `true`
|
||||
### debugdisplay_memory
|
||||
- type `bool`
|
||||
- description `Displays information about the memory usage if true`
|
||||
- default value `true`
|
||||
|
||||
## Resource Manager
|
||||
## resourcemanager_load_invalid_file_as_null
|
||||
- type `bool`
|
||||
- description `Affects the Resource Manager's loadres() function if it encounters a invalid filepath. If true, loadres() will "save" the resource as null, but will do nothing if false.`
|
||||
- default value `false`
|
||||
|
||||
## Splash Screen
|
||||
### splash_enabled
|
||||
- type `bool`
|
||||
- description `Enables or disables the splash screen at startup`
|
||||
- default value `false`
|
||||
- note `You can still call display() and dissolve() manually, this option just affects the startup process.`
|
||||
### splash_image
|
||||
- type `String`
|
||||
- description `The path to your splash image (square-sized)`
|
||||
- default value `[LOADPATH]soscore.png`
|
||||
### splash_image_size
|
||||
- type `int`
|
||||
- description `The width and height of your square-sized image`
|
||||
- default value `256`
|
||||
### splash_color
|
||||
- type `String`
|
||||
- description `The splash screen's background color in hex (without the "#" at the beginning!)`
|
||||
|
||||
## Example configuration
|
||||
This is the full example configuration that you can find as `config.gd.example`
|
||||
```gdscript
|
||||
##############################
|
||||
# THE CORE FRAMEWORK #
|
||||
# EXAMPLE CONFIGURATION FILE #
|
||||
# #
|
||||
# THIS DOCUMENT IS PUBLICLY #
|
||||
# AVAILABLE UNDER THE PUBLIC #
|
||||
# DOMAIN AND IS NOT LICENSED #
|
||||
##############################
|
||||
extends Node
|
||||
|
||||
# Hello there, fellow developer!
|
||||
# This is a example configuration file
|
||||
# for the CORE Framework (source 0).
|
||||
#
|
||||
# Most settings in this config should be
|
||||
# self explanitory. If not, visit the documentation:
|
||||
# https://core.staropensource.de/references/Configuration_File/
|
||||
#
|
||||
# Thank you for using the CORE Framework!
|
||||
# - The StarOpenSource Project & Contributers
|
||||
|
||||
var core_initscript: String = "res://init.gd"
|
||||
|
||||
var preprocessor_enabled: bool = true
|
||||
var preprocessor_diagnostic: bool = false
|
||||
|
||||
var logger_enabled: bool = true
|
||||
var logger_diagnostic: bool = false
|
||||
|
||||
var corelog_enabled: bool = true
|
||||
|
||||
var debugdisplay_enabled: bool = false
|
||||
var debugdisplay_fps: bool = true
|
||||
var debugdisplay_delta: bool = true
|
||||
var debugdisplay_rendertime: bool = true
|
||||
var debugdisplay_memory: bool = true
|
||||
|
||||
var resourcemanager_load_invalid_file_as_null: bool = false
|
||||
|
||||
var splash_enabled: bool = false
|
||||
var splash_image: String = "res://CORE/soscore.png"
|
||||
var splash_image_size: int = 256
|
||||
var splash_color: String = "000000"
|
||||
|
||||
# EOF <- Yes, this is the end of the example configuration! Pretty short, isn't it?
|
||||
```
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Debug Display (/root/CORE/DebugDisplay)
|
||||
Displays useful information in the top-left corner
|
||||
|
||||
## 404 Documentation not found
|
||||
The `Debug Display` module does not have any variables or methods that are relevant to a developer as you can change everything through the configuration file.
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Events (/root/CORE/Events)
|
||||
Just connect a signal to a function and get updates when something happens
|
||||
|
||||
## Signals
|
||||
### window_title
|
||||
- emitted on `window title change`
|
||||
- argument `window_title` (type `String`)
|
||||
- argument `previous_window_title` (type `String`)
|
||||
### window_size
|
||||
- emitted on `window size change`
|
||||
- argument `update_coordinate` (type `String`, can be `X`, `Y` or `BOTH`)
|
||||
- argument `window_size` (type `Vector2i`)
|
||||
- argument `previous_window_size` (type `Vector2i`)
|
||||
### window_pos
|
||||
- emitted on `window position change`
|
||||
- argument `update_coordinate` (type `String`, can be `X`, `Y` or `BOTH`)
|
||||
- argument `window_pos` (type `Vector2i`)
|
||||
- argument `previous_window_pos` (type `Vector2i`)
|
||||
### logger_all
|
||||
- emitted on `log output`
|
||||
- argument `type` (type `String`, can be `"DIAG"`, `"INFO"`, `"WARN"` or `"ERROR"`)
|
||||
- argument `script` (type `String`)
|
||||
- argument `message` (type `String`)
|
||||
### logger_diag
|
||||
- emitted on `diagnostic log output`
|
||||
- argument `script` (type `String`)
|
||||
- argument `message` (type `String`)
|
||||
### logger_info
|
||||
- emitted on `informational log output`
|
||||
- argument `script` (type `String`)
|
||||
- argument `message` (type `String`)
|
||||
### logger_warn
|
||||
- emitted on `warning log output`
|
||||
- argument `script` (type `String`)
|
||||
- argument `message` (type `String`)
|
||||
### logger_error
|
||||
- emitted on `error log output`
|
||||
- argument `script` (type `String`)
|
||||
- argument `message` (type `String`)
|
|
@ -1,76 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Logger (/root/CORE/Logger)
|
||||
The CORE logger implementation (with formatting support!)
|
||||
|
||||
## Signals
|
||||
### logevent
|
||||
- emitted on `log message`
|
||||
- argument `type` (type `String`, can be `DIAG`, `INFO`, `WARN` or `ERR!`)
|
||||
- argument `script` (type `String`)
|
||||
- argument `message` (type `String`)
|
||||
- argument `logmessage` (type `String`, description `The full log message as printed in console`)
|
||||
|
||||
## Methods
|
||||
### diag()
|
||||
- returns `void`
|
||||
- description `Prints a diagnostic message`
|
||||
- argument `script`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The script where the log message is coming from`
|
||||
- argument `message`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Your log message`
|
||||
- argument `preproc`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is true`
|
||||
- description `If the log message should be run through the preprocessor. If false formatting will be disabled for that log message.`
|
||||
### info()
|
||||
- returns `void`
|
||||
- description `Prints a informational message`
|
||||
- argument `script`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The script where the log message is coming from`
|
||||
- argument `message`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Your log message`
|
||||
- argument `preproc`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is true`
|
||||
- description `If the log message should be run through the preprocessor. If false formatting will be disabled for that log message.`
|
||||
### warn()
|
||||
- returns `void`
|
||||
- description `Prints a warning message`
|
||||
- argument `script`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The script where the log message is coming from`
|
||||
- argument `message`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Your log message`
|
||||
- argument `preproc`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is true`
|
||||
- description `If the log message should be run through the preprocessor. If false formatting will be disabled for that log message.`
|
||||
### error()
|
||||
- returns `void`
|
||||
- description `Prints a error message`
|
||||
- argument `script`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The script where the log message is coming from`
|
||||
- argument `message`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Your log message`
|
||||
- argument `preproc`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is true`
|
||||
- description `If the log message should be run through the preprocessor. If false formatting will be disabled for that log message.`
|
|
@ -1,51 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Miscellaneous (/root/CORE/Miscellaneous)
|
||||
Contains small methods that do not deserve their own module.
|
||||
|
||||
## Methods
|
||||
### get_title()
|
||||
- returns `String`
|
||||
- description `Returns the main window title.`
|
||||
- note `This method simply returns the value of get_tree().root.title and is included here as DisplayServer.window_get_title() does not exist.`
|
||||
### get_fps()
|
||||
- returns `float`
|
||||
- description `Returns the current framerate aka. FPS aka. Frames Per Second`
|
||||
- note `If the delta value (which is used in the calculation) is zero, INF (infinity) will be returned.`
|
||||
- argument `flatten`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is false`
|
||||
- description `The decimal numbers will be removed if true`
|
||||
### get_rendertime()
|
||||
- returns `float`
|
||||
- description `Returns the time in milliseconds it took for Godot to render a frame`
|
||||
### get_delta()
|
||||
- returns `float`
|
||||
- description `Returns the delta value you normally see as a argument in _process()`
|
||||
### byte_to_mib()
|
||||
- returns `float`
|
||||
- description `Converts a number of bytes to a number of Mebibytes.`
|
||||
- argument `bytes`
|
||||
- type `int`
|
||||
- mandatory `yes`
|
||||
- description `The number of bytes`
|
||||
- argument `flatten`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is true`
|
||||
- description `The decimal numbers will be removed if true`
|
||||
## flat_float()
|
||||
- returns `float`
|
||||
- description `Removes all decimal numbers from a floating point number.`
|
||||
- argument `number`
|
||||
- type `float`
|
||||
- mandatory `yes`
|
||||
- description `The floating point number`
|
||||
## flat_float_int()
|
||||
- returns `int`
|
||||
- description `Removes all decimal numbers from a floating point number. Returns a integer instead of a float`
|
||||
- argument `number`
|
||||
- type `float`
|
||||
- mandatory `yes`
|
||||
- description `The floating point number`
|
|
@ -1,96 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Preprocessor (/root/CORE/Preprocessor)
|
||||
The **Preprocessor** parses tags and is responsible for formatting text.
|
||||
|
||||
## Tags *(these can be used in log messages too!)*
|
||||
All tags can be escaped by adding `esc_` before the tag name, if you want to do that. Example:
|
||||
```text
|
||||
Raw: <esc_up><esc_np></esc_lo>
|
||||
Output: <up><np></lo>
|
||||
```
|
||||
### No process `<np>`
|
||||
- end tag `no`
|
||||
- description `Disables preprocessing completely. Doesn't even display the prefix.`
|
||||
- example:
|
||||
``` text
|
||||
Raw: <up>This is a</up><pa>test</pa><np> MESS<lo>age</lo>.
|
||||
Output: <up>This is a</up><pa>test</pa> MESS<lo>age</lo>.
|
||||
```
|
||||
### Newline `<nl>`
|
||||
- end tag `no`
|
||||
- description `Makes a newline while respecting the prefix. Is much recommended over "\n".`
|
||||
- example (with prefix `prefix_`):
|
||||
``` text
|
||||
Raw: Very nice message!<nl>Here's another message :)
|
||||
Output:
|
||||
prefix_Very nice message!
|
||||
Here's another message :)
|
||||
```
|
||||
### Lowercase `<lo></lo>`
|
||||
- end tag `yes`
|
||||
- description `Makes your text lowercase.`
|
||||
- example:
|
||||
``` text
|
||||
Raw: Did <lo>you FiNd THA</lo>T funny?
|
||||
Output: Did you find thaT funny?
|
||||
```
|
||||
### Uppercase `<up></up>`
|
||||
- end tag `yes`
|
||||
- description `Makes your text uppercase.`
|
||||
- example:
|
||||
``` text
|
||||
Raw: ThiS Te<up>XT should be UPPer</up>caSED
|
||||
Output: ThiS TeXT SHOULD BE UPPERcaSED
|
||||
```
|
||||
### Camelcase `<ca></ca>`
|
||||
- end tag `yes`
|
||||
- description `Makes your text camelcase.`
|
||||
- example:
|
||||
``` text
|
||||
Raw: This <ca>text should be CamelCa</ca>sed.
|
||||
Output: This textShouldBeCamelCased.
|
||||
```
|
||||
### Pascalcase `<pa></pa>`
|
||||
- end tag `yes`
|
||||
- description `Makes your text pascalcase.`
|
||||
- example:
|
||||
``` text
|
||||
Raw: This <pa>text should be PascelCa</pa>sed.
|
||||
Output: This TextShouldBePascelCased.
|
||||
```
|
||||
### Snakecase `<sn></sn>`
|
||||
- end tag `yes`
|
||||
- description `Makes your text snakecase.`
|
||||
- example:
|
||||
``` text
|
||||
Raw: This <sn>text should be SnakeCa</sn>sed.
|
||||
Output: This text_should_be_snake_cased.
|
||||
```
|
||||
|
||||
## Methods
|
||||
### process()
|
||||
- returns `String`
|
||||
- description `Formats a message`
|
||||
- argument `msg`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The message used for processing`
|
||||
- argument `prefix`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The prefix used for newlines`
|
||||
- argument `pre_msg`
|
||||
- type `String`
|
||||
- mandatory `no, default value is ""`
|
||||
- description `Inserted before the message`
|
||||
- argument `post_msg`
|
||||
- type `String`
|
||||
- mandatory `no, default value is ""`
|
||||
- description `Inserted after the message`
|
||||
- argument `exclusion_filter`
|
||||
- type `Array`
|
||||
- mandatory `no, default value is []`
|
||||
- description `Removes specific Strings from the prefix (used in calculating spaces when using <nl>)`
|
|
@ -1,56 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Resource Manager (/root/CORE/ResourceManager)
|
||||
Responsible for loading and unloading resources, even in batches.
|
||||
|
||||
## Methods
|
||||
### loadres()
|
||||
- returns `void`
|
||||
- description `Loads a resource.`
|
||||
- argument `resource_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The name of the resource. Used when getting or unloading the resource.`
|
||||
- argument `resource_path`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The path to the resource.`
|
||||
- argument `replace`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is false`
|
||||
- description `If a already existing resource should be overridden or not.`
|
||||
### unloadres()
|
||||
- returns `void`
|
||||
- description `Unloads a resource.`
|
||||
- argument `resource_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The resource name.`
|
||||
### loadbatch()
|
||||
- returns `void`
|
||||
- description `Loads a batch of resources.`
|
||||
- argument `batch`
|
||||
- type `Directory`
|
||||
- mandatory `yes`
|
||||
- description `A batch of resources to load.`
|
||||
- format `{"resource_name":"resource_path"}`
|
||||
- argument `replace`
|
||||
- type `bool`
|
||||
- mandatory `no, default value is false`
|
||||
- description `If a already exiting resource should be overridden or not.`
|
||||
### unloadbatch()
|
||||
- returns `void`
|
||||
- description `Unloads a batch of resources.`
|
||||
- argument `batch`
|
||||
- type `Array`
|
||||
- mandatory `yes`
|
||||
- description `A batch of resources to unload.`
|
||||
- format `["resource_name"]`
|
||||
### getres()
|
||||
- description `Returns the requested resource or null if not found.`
|
||||
- argument `resource_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `The resource name.`
|
|
@ -1,79 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Scene Manager (/root/CORE/SceneManager)
|
||||
Responsible for displaying scenes using overlays.
|
||||
|
||||
## Overlays
|
||||
The scene manager uses something called **overlays**. A overlay can either hold one scene or multiple scenes and are used to keep scenes in order.
|
||||
### Overlay #1 - `debug`
|
||||
- description `The overlay with the highest priority and is displayed over all other overlays. Should contain debug scenes.`
|
||||
- more than one scene `yes`
|
||||
- adding a scene **[add_debug()](#add_debug)**
|
||||
- removing a scene **[remove_debug()](#remove_debug)**
|
||||
### Overlay #2 - `cutscene`
|
||||
- description `Has the second highest priority and is displayed over all overlays except debug. Should contain... well cutscenes.`
|
||||
- more than one scene `no`
|
||||
- adding a scene **[add_cutscene()](#add_cutscene)**
|
||||
- removing a scene **[remove_cutscene()](#remove_cutscene)**
|
||||
### Overlay #3 - `menu`
|
||||
- description `The overlay with the second lowest priority. Should contain menus.`
|
||||
- more than one scene `yes`
|
||||
- adding a scene **[add_menu()](#add_menu)**
|
||||
- removing a scene **[remove_menu()](#remove_menu)**
|
||||
### Overlay #4 - `action`
|
||||
- description `Has the lowest priority. This overlay should contain your main menu, your program's main interface or your level.`
|
||||
- more than one scene `no`
|
||||
- adding a scene **[add_action()](#add_action)**
|
||||
- removing a scene **[remove_action()](#remove_action)**
|
||||
|
||||
## Methods
|
||||
### add_debug()
|
||||
- returns `bool`
|
||||
- description `Adds a PackedScene to the debug overlay.`
|
||||
- argument `resource_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Used for loading the scene and the loaded scene name.`
|
||||
### remove_debug()
|
||||
- returns `bool`
|
||||
- description `Removes a menu scene from the debug overlay.`
|
||||
- argument `scene_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Should be the same as the "resource_name" argument used previously in add_debug().`
|
||||
### add_cutscene()
|
||||
- returns `bool`
|
||||
- description `Adds a PackedScene to the cutscene overlay.`
|
||||
- argument `resource_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Used for loading the scene and the loaded scene name.`
|
||||
### remove_cutscene()
|
||||
- returns `bool`
|
||||
- description `Removes the game scene from the cutscene overlay.`
|
||||
### add_menu()
|
||||
- returns `bool`
|
||||
- description `Adds a PackedScene to the menu overlay.`
|
||||
- argument `resource_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Used for loading the scene and the loaded scene name.`
|
||||
### remove_menu()
|
||||
- returns `bool`
|
||||
- description `Removes a menu scene from the menu overlay.`
|
||||
- argument `scene_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Should be the same as the "resource_name" argument used previously in add_menu().`
|
||||
### add_action()
|
||||
- returns `bool`
|
||||
- description `Adds a PackedScene to the action overlay.`
|
||||
- argument `resource_name`
|
||||
- type `String`
|
||||
- mandatory `yes`
|
||||
- description `Used for loading the scene and the loaded scene name.`
|
||||
### remove_action()
|
||||
- returns `bool`
|
||||
- description `Removes the game scene from the action overlay.`
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Splash Screen (/root/CORE/SplashScreen)
|
||||
Allows you to display a nice loading screen.
|
||||
|
||||
## Methods
|
||||
### display()
|
||||
- returns `void`
|
||||
- description `Makes the splash screen visible.`
|
||||
### dissolve()
|
||||
- returns `void`
|
||||
- description `Makes the splash screen invisible.`
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# References index
|
||||
Welcome to the reference documentation! Here you can find everything you need to develop your game or application with CORE.
|
||||
|
||||
## [The CORE configuration file](/references/Configuration_File/)
|
||||
## [CORE](/references/CORE/)
|
||||
## [Logger](/references/Logger/)
|
||||
## [Preprocessor](/references/Preprocessor/)
|
||||
## [Resource Manager](/references/ResourceManager/)
|
||||
## [Scene Manager](/references/SceneManager/)
|
||||
## [Splash Screen](/references/SplashScreen/)
|
||||
## [Debug Display](/references/DebugDisplay/)
|
||||
## [Miscellaneous](/references/Miscellaneous/)
|
||||
## [Events](/references/Events/)
|
20
docs/sidebars.ts
Normal file
20
docs/sidebars.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
const sidebars: SidebarsConfig = {
|
||||
sidebar: [{type: 'autogenerated', dirName: '.'}],
|
||||
|
||||
// But you can create a sidebar manually
|
||||
/*
|
||||
tutorialSidebar: [
|
||||
'intro',
|
||||
'hello',
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Tutorial',
|
||||
items: ['tutorial-basics/create-a-document'],
|
||||
},
|
||||
],
|
||||
*/
|
||||
};
|
||||
|
||||
export default sidebars;
|
24
docs/src/css/custom.css
Normal file
24
docs/src/css/custom.css
Normal file
|
@ -0,0 +1,24 @@
|
|||
:root {
|
||||
--ifm-color-primary: #d60532;
|
||||
--ifm-color-primary-dark: #c4052e;
|
||||
--ifm-color-primary-darker: #af072b;
|
||||
--ifm-color-primary-darkest: #990525;
|
||||
--ifm-color-primary-light: #db1943;
|
||||
--ifm-color-primary-lighter: #ec2c56;
|
||||
--ifm-color-primary-lightest: #fa3e67;
|
||||
--ifm-code-font-size: 95%;
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* For readability concerns, you should choose a lighter palette in dark mode.
|
||||
Note from JeremyStarTM: Readability concerns? It looks beautiful! */
|
||||
[data-theme='dark'] {
|
||||
--ifm-color-primary: #d60532;
|
||||
--ifm-color-primary-dark: #c4052e;
|
||||
--ifm-color-primary-darker: #af072b;
|
||||
--ifm-color-primary-darkest: #990525;
|
||||
--ifm-color-primary-light: #db1943;
|
||||
--ifm-color-primary-lighter: #ec2c56;
|
||||
--ifm-color-primary-lightest: #fa3e67;
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
||||
}
|
23
docs/src/pages/index.module.css
Normal file
23
docs/src/pages/index.module.css
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* CSS files with the .module.css suffix will be treated as CSS modules
|
||||
* and scoped locally.
|
||||
*/
|
||||
|
||||
.heroBanner {
|
||||
padding: 4rem 0;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 996px) {
|
||||
.heroBanner {
|
||||
padding: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
27
docs/src/pages/index.tsx
Normal file
27
docs/src/pages/index.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import Layout from '@theme/Layout';
|
||||
import Heading from '@theme/Heading';
|
||||
|
||||
import styles from './index.module.css';
|
||||
|
||||
export default function Home(): JSX.Element {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<Layout
|
||||
title={``}
|
||||
description="The Presencode documentation">
|
||||
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
||||
<div className="container">
|
||||
<Heading as="h1" className="hero__title">You shouldn't see this.</Heading>
|
||||
<p className="hero__subtitle">You should have been redirected to the <b>About</b> page.</p>
|
||||
<div className={styles.buttons}>
|
||||
<Link className="button button--secondary button--lg" to="/about">Click here to get there
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</Layout>
|
||||
);
|
||||
}
|
0
docs/static/.nojekyll
vendored
Normal file
0
docs/static/.nojekyll
vendored
Normal file
1
docs/static/dist
vendored
Symbolic link
1
docs/static/dist
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../dist
|
|
@ -1,5 +0,0 @@
|
|||
:root {
|
||||
--md-primary-fg-color: #D60532;
|
||||
--md-primary-fg-color--light: #D60532;
|
||||
--md-primary-fg-color--dark: #D60532;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Troubleshooting CORE
|
||||
**Warning:** This is a very messy document. Use the table of contents to get to your specified error. If you can't find your problem here, [create a issue](https://git.staropensource.de/staropensource/core/issues/new).
|
||||
|
||||
## Work In Progress
|
||||
This page will be documented soon. Just shoot [a mail](mailto:support@staropensource.de) or [a private message](https://net.staropensource.de/@soscore) at us for now.
|
8
docs/tsconfig.json
Normal file
8
docs/tsconfig.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
// This file is not used in compilation. It is here just for a nice editor experience.
|
||||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"jsx": "react",
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
# Updating CORE
|
||||
Updating CORE is the same process as installing it. Just click on `Update` instead of `Install` in the **CORE Manager**.
|
||||
|
||||
### [Click to visit the installation page](/install/)
|
95
events.gd
95
events.gd
|
@ -1,95 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Used for checking if any values have changed
|
||||
var prev_window_title: String = ""
|
||||
var prev_window_size_x: int = 0
|
||||
var prev_window_size_y: int = 0
|
||||
var prev_window_pos_x: int = 0
|
||||
var prev_window_pos_y: int = 0
|
||||
|
||||
# Event signals
|
||||
signal window_title
|
||||
signal window_size
|
||||
signal window_pos
|
||||
signal logger_all
|
||||
signal logger_diag
|
||||
signal logger_info
|
||||
signal logger_warn
|
||||
signal logger_error
|
||||
|
||||
# Set up connection between logger's logevent and logger_update()
|
||||
func initialize() -> void:
|
||||
if core.protection_mode: return
|
||||
# logevent (signal) -> logger_update()
|
||||
logger.connect("logevent",Callable(self,"logger_update"))
|
||||
|
||||
func logger_update(type:String,script:String,message:String,_logmessage:String) -> void:
|
||||
if core.protection_mode: return
|
||||
# Emit signal logger_all for all log messages
|
||||
emit_signal("logger_all",type,script,message)
|
||||
# Check for log type and emit the right signal
|
||||
if type == "DIAG":
|
||||
emit_signal("logger_diag",script,message)
|
||||
elif type == "INFO":
|
||||
emit_signal("logger_info",script,message)
|
||||
elif type == "WARN":
|
||||
emit_signal("logger_warn",script,message)
|
||||
elif type == "ERR!":
|
||||
emit_signal("logger_error",script,message)
|
||||
else:
|
||||
core.exception("events","The log type \"" + type + "\" is not known to events.gd")
|
||||
|
||||
# Check various variables and emit signals if they changed
|
||||
func _process(_delta:float) -> void:
|
||||
process_window_title()
|
||||
process_window_size()
|
||||
process_window_pos()
|
||||
|
||||
func process_window_title() -> void:
|
||||
var new_window_title: String = get_tree().root.title
|
||||
if prev_window_title != new_window_title:
|
||||
emit_signal("window_title",new_window_title,prev_window_title)
|
||||
prev_window_title = new_window_title
|
||||
|
||||
func process_window_size() -> void:
|
||||
var new_window_size_x: int = DisplayServer.window_get_size().x
|
||||
var new_window_size_y: int = DisplayServer.window_get_size().y
|
||||
if new_window_size_x != prev_window_size_x and new_window_size_y != prev_window_size_y:
|
||||
emit_signal("window_size","BOTH",Vector2i(new_window_size_x,new_window_size_y),Vector2i(prev_window_size_x,prev_window_size_y))
|
||||
prev_window_size_x = new_window_size_x
|
||||
prev_window_size_y = new_window_size_y
|
||||
elif new_window_size_x != prev_window_size_x:
|
||||
emit_signal("window_size","X",Vector2i(new_window_size_x,new_window_size_y),Vector2i(prev_window_size_x,prev_window_size_y))
|
||||
prev_window_size_x = new_window_size_x
|
||||
elif new_window_size_y != prev_window_size_y:
|
||||
emit_signal("window_size","Y",Vector2i(new_window_size_x,new_window_size_y),Vector2i(prev_window_size_x,prev_window_size_y))
|
||||
prev_window_size_y = new_window_size_y
|
||||
|
||||
func process_window_pos() -> void:
|
||||
var new_window_pos_x: int = DisplayServer.window_get_position().x
|
||||
var new_window_pos_y: int = DisplayServer.window_get_position().y
|
||||
if new_window_pos_x != prev_window_pos_x and new_window_pos_y != prev_window_pos_y:
|
||||
emit_signal("window_pos","BOTH",Vector2i(new_window_pos_x,new_window_pos_y),Vector2i(prev_window_pos_x,prev_window_pos_y))
|
||||
prev_window_pos_x = new_window_pos_x
|
||||
prev_window_pos_y = new_window_pos_y
|
||||
elif new_window_pos_x != prev_window_pos_x:
|
||||
emit_signal("window_pos","X",Vector2i(new_window_pos_x,new_window_pos_y),Vector2i(prev_window_pos_x,prev_window_pos_y))
|
||||
prev_window_pos_x = new_window_pos_x
|
||||
elif new_window_pos_y != prev_window_pos_y:
|
||||
emit_signal("window_pos","Y",Vector2i(new_window_pos_x,new_window_pos_y),Vector2i(prev_window_pos_x,prev_window_pos_y))
|
||||
prev_window_pos_y = new_window_pos_y
|
BIN
hack.ttf
BIN
hack.ttf
Binary file not shown.
118
logger.gd
118
logger.gd
|
@ -1,118 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var preprocessor: Node = null
|
||||
|
||||
# Enables/disables the logger
|
||||
var enabled: bool = true
|
||||
# Enables/disables diagnostic log messages
|
||||
var diagnostic: bool = false
|
||||
|
||||
# Signals
|
||||
signal logevent
|
||||
|
||||
func initialize() -> void:
|
||||
if core.protection_mode: return
|
||||
if preprocessor == null:
|
||||
return
|
||||
diag("CORE/logger.gd","Logger is ready.")
|
||||
|
||||
func diag(script:String,message:String,preproc:bool = true) -> void:
|
||||
if core.protection_mode: return
|
||||
# Check if both the logger and diagnostic log messages are enabled
|
||||
if enabled and diagnostic:
|
||||
# Check if preprocessing is allowed for this message and if the preprocessor is enabled
|
||||
if preproc and preprocessor.enabled:
|
||||
# Run the message through the preprocessor if enabled/allowed
|
||||
var logmsg: String = preprocessor.process(message,"[color=gray](" + script + ") [DIAG] [/color]","[color=gray][b]","[/b][/color]",["[color=gray]","[/color]"])
|
||||
# Print the message
|
||||
print_rich(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","DIAG",script,message,logmsg)
|
||||
else:
|
||||
# Construct a log message normally if preprocessor is disabled/disallowed
|
||||
# Note: We do not include bold and color tags in here because they can mess
|
||||
# up the log messages in some cases
|
||||
var logmsg: String = "(" + script + ") [DIAG] " + message
|
||||
# Print the message
|
||||
print(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","DIAG",script,message,logmsg)
|
||||
|
||||
func info(script:String,message:String,preproc:bool = true) -> void:
|
||||
if core.protection_mode: return
|
||||
# Check if the logger is enabled
|
||||
if enabled:
|
||||
# Check if preprocessing is allowed for this message and if the preprocessor is enabled
|
||||
if preproc and preprocessor.enabled:
|
||||
# Run the message through the preprocessor if enabled/allowed
|
||||
var logmsg: String = preprocessor.process(message,"[color=white](" + script + ") [INFO] [/color]","[color=white][b]","[/b][/color]",["[color=white]","[/color]"])
|
||||
# Print the message
|
||||
print_rich(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","INFO",script,message,logmsg)
|
||||
else:
|
||||
# Construct a log message normally if preprocessor is disabled/disallowed
|
||||
# Note: We do not include bold and color tags in here because they can mess
|
||||
# up the log messages in some cases
|
||||
var logmsg: String = "(" + script + ") [INFO] " + message
|
||||
# Print the message
|
||||
print(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","INFO",script,message,logmsg)
|
||||
|
||||
func warn(script:String,message:String,preproc:bool = true) -> void:
|
||||
if core.protection_mode: return
|
||||
# Check if the logger is enabled
|
||||
if enabled:
|
||||
# Check if preprocessing is allowed for this message and if the preprocessor is enabled
|
||||
if preproc and preprocessor.enabled:
|
||||
# Run the message through the preprocessor if enabled/allowed
|
||||
var logmsg: String = preprocessor.process(message,"[color=orange](" + script + ") [WARN] [/color]","[color=orange][b]","[/b][/color]",["[color=orange]","[/color]"])
|
||||
# Print the message
|
||||
print_rich(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","WARN",script,message,logmsg)
|
||||
else:
|
||||
# Construct a log message normally if preprocessor is disabled/disallowed
|
||||
# Note: We do not include bold and color tags in here because they can mess
|
||||
# up the log messages in some cases
|
||||
var logmsg: String = "(" + script + ") [WARN] " + message
|
||||
# Print the message
|
||||
print(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","WARN",script,message,logmsg)
|
||||
|
||||
func error(script:String,message:String,preproc:bool = true) -> void:
|
||||
if core.protection_mode: return
|
||||
# Check if the logger is enabled
|
||||
if enabled:
|
||||
# Check if preprocessing is allowed for this message and if the preprocessor is enabled
|
||||
if preproc and preprocessor.enabled:
|
||||
# Run the message through the preprocessor if enabled/allowed
|
||||
var logmsg: String = preprocessor.process(message,"[color=red](" + script + ") [ERR!] [/color]","[color=red][b]","[/b][/color]",["[color=red]","[/color]"])
|
||||
# Print the message
|
||||
print_rich(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","ERR!",script,message,logmsg)
|
||||
else:
|
||||
# Construct a log message normally if preprocessor is disabled/disallowed
|
||||
# Note: We do not include bold and color tags in here because they can mess
|
||||
# up the log messages in some cases
|
||||
var logmsg: String = "(" + script + ") [ERR!] " + message
|
||||
# Print the message
|
||||
print(logmsg)
|
||||
# Emit logevent signal
|
||||
emit_signal("logevent","ERR!",script,message,logmsg)
|
72
misc.gd
72
misc.gd
|
@ -1,72 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
|
||||
# Delta value, used for get_fps() and get_delta()
|
||||
var delta: float = 0.0
|
||||
|
||||
# Updates delta variable
|
||||
func _process(delta_process) -> void:
|
||||
delta = delta_process
|
||||
|
||||
# Returns the title of the main window
|
||||
## Included as DisplayServer.window_get_title() (for some
|
||||
## reason) does not exist and not many know that /root/
|
||||
## is a Window node (which does have a "title" variable)
|
||||
func get_title() -> String:
|
||||
if core.protection_mode: return ""
|
||||
return get_tree().root.title
|
||||
|
||||
# Returns the current FPS (Frames Per Second) value
|
||||
func get_fps(flatten:bool = false) -> float:
|
||||
if core.protection_mode: return 0.0
|
||||
if str(delta) == "0":
|
||||
# In the rare case where delta is zero, return INF
|
||||
return INF
|
||||
else:
|
||||
if flatten:
|
||||
# Removes decimal numbers
|
||||
return float(int(1/delta))
|
||||
else:
|
||||
# Yes, it's weird but 1/delta does return the FPS value.
|
||||
return 1/delta
|
||||
|
||||
# Returns the time it took Godot to render a frame
|
||||
func get_rendertime() -> float:
|
||||
if core.protection_mode: return 0.0
|
||||
return Performance.get_monitor(Performance.TIME_PROCESS)
|
||||
|
||||
# Returns the delta time
|
||||
func get_delta() -> float:
|
||||
if core.protection_mode: return 0.0
|
||||
return delta
|
||||
|
||||
# Converts a number of bytes to a number of mebibytes
|
||||
func byte_to_mib(bytes:int,flatten:bool = true) -> float:
|
||||
if flatten:
|
||||
@warning_ignore("integer_division")
|
||||
return bytes/1048576
|
||||
return bytes/float(1048576)
|
||||
|
||||
# Flattens a floating point number
|
||||
func flat_float(number:float) -> float:
|
||||
return float(int(number))
|
||||
|
||||
func flat_float_int(number:float) -> int:
|
||||
return int(number)
|
||||
|
||||
# Get object center
|
||||
func get_object_center(child_size:float,parent_size:float) -> float:
|
||||
return parent_size/2-child_size/2
|
78
mkdocs.yml
78
mkdocs.yml
|
@ -1,78 +0,0 @@
|
|||
site_name: CORE Framework
|
||||
site_url: https://core.staropensource.de
|
||||
copyright: 'Licensed under the <a href="https://git.staropensource.de/StarOpenSource/core/src/branch/develop/LICENSE">GNU General Public License v3</a>'
|
||||
repo_url: https://git.staropensource.de/staropensource/core
|
||||
edit_uri: _edit/develop/docs/
|
||||
extra_css:
|
||||
- stylesheets/colors.css
|
||||
- https://fs.staropensource.de/roboto.css
|
||||
- https://fs.staropensource.de/roboto-mono.css
|
||||
markdown_extensions:
|
||||
- pymdownx.caret
|
||||
- pymdownx.mark
|
||||
- pymdownx.tilde
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.superfences
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Licensing: licensing.md
|
||||
- Installing: install.md
|
||||
- Quick Start Guide: quickstartguide.md
|
||||
- Breaking commits: breaking-commits.md
|
||||
- Troubleshooting: troubleshooting.md
|
||||
- References: references/
|
||||
- Source code: https://git.staropensource.de/staropensource/core/
|
||||
theme:
|
||||
name: material
|
||||
logo: https://git.staropensource.de/staropensource/core/raw/branch/develop/soscore_round.png
|
||||
favicon: favicon.png
|
||||
language: en
|
||||
features:
|
||||
- navigation.instant
|
||||
- navigation.tabs
|
||||
- navigation.path
|
||||
- navigation.prune
|
||||
- navigation.top
|
||||
- navigation.footer
|
||||
- header.autohide
|
||||
- toc.follow
|
||||
- announce.dismiss
|
||||
- content.action.edit
|
||||
- content.code.copy
|
||||
- content.code.annotate
|
||||
- search.suggest
|
||||
font: false
|
||||
icon:
|
||||
repo: fontawesome/brands/git-alt
|
||||
edit: material/pencil
|
||||
view: material/eye
|
||||
palette:
|
||||
- scheme: slate
|
||||
primary: custom
|
||||
toggle:
|
||||
icon: material/weather-sunny
|
||||
name: Switch to light mode
|
||||
- scheme: default
|
||||
primary: custom
|
||||
toggle:
|
||||
icon: material/weather-night
|
||||
name: Switch to dark mode
|
||||
extra:
|
||||
social:
|
||||
- icon: fontawesome/brands/mastodon
|
||||
link: https://net.staropensource.de/@soscore
|
||||
name: '@soscore@net.staropensource.de'
|
||||
- icon: fontawesome/brands/git-alt
|
||||
link: https://git.staropensource.de/staropensource/core/
|
||||
name: StarOpenSource/core.git
|
||||
homepage: https://core.staropensource.de
|
||||
plugins:
|
||||
- git-revision-date-localized:
|
||||
enable_creation_date: true
|
||||
type: datetime
|
||||
- search:
|
||||
lang: en
|
40
mkdown.gd
40
mkdown.gd
|
@ -1,40 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Font sizes
|
||||
var fsizes: Dictionary = {"text":"16","h1":"29","h2":"24","h3":"19","h4":"14","h5":"9","h6":"4"}
|
||||
|
||||
func parse(content:String) -> String:
|
||||
var parse_text: String = ""
|
||||
for line in content.split("\n",false):
|
||||
var line_mod: String = line
|
||||
if line_mod.begins_with("######"):
|
||||
line_mod = line_mod.replace("######","[font_size=" + fsizes["h6"] + "]") + "[/font_size]"
|
||||
elif line_mod.begins_with("#####"):
|
||||
line_mod = line_mod.replace("#####","[font_size=" + fsizes["h5"] + "]") + "[/font_size]"
|
||||
elif line_mod.begins_with("####"):
|
||||
line_mod = line_mod.replace("####","[font_size=" + fsizes["h4"] + "]") + "[/font_size]"
|
||||
elif line_mod.begins_with("###"):
|
||||
line_mod = line_mod.replace("###","[font_size=" + fsizes["h3"] + "]") + "[/font_size]"
|
||||
elif line_mod.begins_with("##"):
|
||||
line_mod = line_mod.replace("##","[font_size=" + fsizes["h2"] + "]") + "[/font_size]"
|
||||
elif line_mod.begins_with("#"):
|
||||
line_mod = line_mod.replace("#","[font_size=" + fsizes["h1"] + "]") + "[/font_size]"
|
||||
else:
|
||||
line_mod = "[font_size=" + fsizes["text"] + "]" + line_mod + "[/font_size]"
|
||||
parse_text = parse_text + line_mod + "\n"
|
||||
return parse_text
|
217
preprocessor.gd
217
preprocessor.gd
|
@ -1,217 +0,0 @@
|
|||
######################################
|
||||
# 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
|
||||
|
||||
## ## # ##### ##### ####
|
||||
## # # # # # # #
|
||||
## # # # # # # ####
|
||||
## # ## # # # #
|
||||
## # # ##### # ####
|
||||
## The preprocessor is *very* undocumented at this point
|
||||
## in time as it is a little bit complicated. We may document
|
||||
## it in the future, but for now you have to read the source.
|
||||
##
|
||||
## - JeremyStarTM
|
||||
|
||||
# CORE modules
|
||||
var core: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Enables/disables preprocessor functionality
|
||||
@export var enabled = true
|
||||
# Do not enable unless you exactly know what you are doing!
|
||||
# It will spam your log chock full of useless garbage!
|
||||
@export var diagnostic = false
|
||||
|
||||
# Checks if logger is null
|
||||
func initialize() -> void:
|
||||
if core.protection_mode: return
|
||||
if logger == null:
|
||||
return
|
||||
logger.diag("CORE/preprocessor.gd","Preprocessor is ready.",false)
|
||||
|
||||
# Parses <nl> tags
|
||||
func _newline(msg:String,prefix:String,pre_msg:String,post_msg:String,exclusion_filter:Array) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing newline tags",false)
|
||||
var prefix_space = prefix
|
||||
for exclusion in exclusion_filter:
|
||||
prefix_space = prefix_space.replace(exclusion,"")
|
||||
prefix_space = " ".repeat(prefix_space.length())
|
||||
var msg_proc = prefix + pre_msg + msg.replace("<nl>",post_msg + "\n" + prefix_space + pre_msg) + post_msg
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed newline tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Parses <lo> and </lo> tags
|
||||
func _case_lower(msg:String) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing lowercase tags",false)
|
||||
var msg_proc = msg
|
||||
while true:
|
||||
var index_one = msg_proc.find("<lo>")
|
||||
var index_two = msg_proc.find("</lo>")
|
||||
if index_one != -1:
|
||||
if index_two != -1:
|
||||
index_two = index_two + 5 - index_one
|
||||
var index_proc = msg_proc.substr(index_one,index_two)
|
||||
msg_proc = msg_proc.replace(index_proc,index_proc.replace("<lo>","").replace("</lo>","").to_lower())
|
||||
else:
|
||||
core.exception("Preprocessor","Failed parsing lowercase tags in message \"" + msg + "\" (missing end tag?)")
|
||||
msg_proc = msg
|
||||
break
|
||||
else:
|
||||
break
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed lowercase tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Parses <up> and </up> tags
|
||||
func _case_upper(msg:String) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing uppercase tags",false)
|
||||
var msg_proc = msg
|
||||
while true:
|
||||
var index_one = msg_proc.find("<up>")
|
||||
var index_two = msg_proc.find("</up>")
|
||||
if index_one != -1:
|
||||
if index_two != -1:
|
||||
index_two = index_two + 5 - index_one
|
||||
var index_proc = msg_proc.substr(index_one,index_two)
|
||||
msg_proc = msg_proc.replace(index_proc,index_proc.replace("<up>","").replace("</up>","").to_upper())
|
||||
else:
|
||||
core.exception("Preprocessor","Failed parsing uppercase tags in message \"" + msg + "\" (missing end tag?)")
|
||||
msg_proc = msg
|
||||
break
|
||||
else:
|
||||
break
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed uppercase tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Parses <ca> and </ca> tags
|
||||
func _case_camelcase(msg:String) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing camelcase tags",false)
|
||||
var msg_proc = msg
|
||||
while true:
|
||||
var index_one = msg_proc.find("<ca>")
|
||||
var index_two = msg_proc.find("</ca>")
|
||||
if index_one != -1:
|
||||
if index_two != -1:
|
||||
index_two = index_two + 5 - index_one
|
||||
var index_proc = msg_proc.substr(index_one,index_two)
|
||||
msg_proc = msg_proc.replace(index_proc,index_proc.replace("<ca>","").replace("</ca>","").to_camel_case())
|
||||
else:
|
||||
core.exception("Preprocessor","Failed parsing camelcase tags in message \"" + msg + "\" (missing end tag?)")
|
||||
msg_proc = msg
|
||||
break
|
||||
else:
|
||||
break
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed camelcase tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Parses <pa> and </pa> tags
|
||||
func _case_pascalcase(msg:String) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing pascalcase tags",false)
|
||||
var msg_proc = msg
|
||||
while true:
|
||||
var index_one = msg_proc.find("<pa>")
|
||||
var index_two = msg_proc.find("</pa>")
|
||||
if index_one != -1:
|
||||
if index_two != -1:
|
||||
index_two = index_two + 5 - index_one
|
||||
var index_proc = msg_proc.substr(index_one,index_two)
|
||||
msg_proc = msg_proc.replace(index_proc,index_proc.replace("<pa>","").replace("</pa>","").to_pascal_case())
|
||||
else:
|
||||
core.exception("Preprocessor","Failed parsing pascalcase tags in message \"" + msg + "\" (missing end tag?)")
|
||||
msg_proc = msg
|
||||
break
|
||||
else:
|
||||
break
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed pascalcase tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Parses <sn> and </sn> tags
|
||||
func _case_snakecase(msg:String) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing snakecase tags",false)
|
||||
var msg_proc = msg
|
||||
while true:
|
||||
var index_one = msg_proc.find("<sn>")
|
||||
var index_two = msg_proc.find("</sn>")
|
||||
if index_one != -1:
|
||||
if index_two != -1:
|
||||
index_two = index_two + 5 - index_one
|
||||
var index_proc = msg_proc.substr(index_one,index_two)
|
||||
msg_proc = msg_proc.replace(index_proc,index_proc.replace("<sn>","").replace("</sn>","").to_snake_case())
|
||||
else:
|
||||
core.exception("Preprocessor","Failed parsing snakecase tags in message \"" + msg + "\" (missing end tag?)")
|
||||
msg_proc = msg
|
||||
break
|
||||
else:
|
||||
break
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed snakecase tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Function calls to everything *case-related
|
||||
func _case(msg:String) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing casing tags",false)
|
||||
var msg_proc = _case_lower(msg)
|
||||
msg_proc = _case_upper(msg_proc)
|
||||
msg_proc = _case_camelcase(msg_proc)
|
||||
msg_proc = _case_pascalcase(msg_proc)
|
||||
msg_proc = _case_snakecase(msg_proc)
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed casing tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Replaces all escapes
|
||||
func _escapes(msg:String) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic:logger.diag("CORE/preprocessor.gd","Parsing escape tags",false)
|
||||
var msg_proc = msg.replace("<esc_nl>","<nl>")
|
||||
msg_proc = msg_proc.replace("<esc_up>","<up>")
|
||||
msg_proc = msg_proc.replace("<esc_lo>","<lo>")
|
||||
msg_proc = msg_proc.replace("<esc_ca>","<ca>")
|
||||
msg_proc = msg_proc.replace("<esc_pa>","<pa>")
|
||||
msg_proc = msg_proc.replace("<esc_sn>","<sn>")
|
||||
msg_proc = msg_proc.replace("</esc_up>","</up>")
|
||||
msg_proc = msg_proc.replace("</esc_lo>","</lo>")
|
||||
msg_proc = msg_proc.replace("</esc_ca>","</ca>")
|
||||
msg_proc = msg_proc.replace("</esc_pa>","</pa>")
|
||||
msg_proc = msg_proc.replace("</esc_sn>","</sn>")
|
||||
msg_proc = msg_proc.replace("<esc_np>","<np>")
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsed escape tags. Transformed \"" + msg + "\" into \"" + msg_proc + "\"",false)
|
||||
return msg_proc
|
||||
|
||||
# Checks for <np> tag and if found stops processing
|
||||
func _noprocess(msg:String) -> bool:
|
||||
if core.protection_mode: return true
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Checking for noprocess tag", false)
|
||||
if msg.contains("<np>"):
|
||||
return true
|
||||
return false
|
||||
|
||||
# Executes all preprocessing functions and returns their combined work
|
||||
func process(msg:String,prefix:String = "",pre_msg:String = "",post_msg:String = "",exclusion_filter:Array = []) -> String:
|
||||
if core.protection_mode: return ""
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Call to process() recieved",false)
|
||||
if !enabled:
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing failed: Preprocessor is disabled",false)
|
||||
return msg
|
||||
if _noprocess(msg):
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing stopped: noprocess tag detected", false)
|
||||
return msg
|
||||
var msg_proc = _case(msg)
|
||||
msg_proc = _newline(msg_proc,prefix,pre_msg,post_msg,exclusion_filter)
|
||||
msg_proc = _escapes(msg_proc)
|
||||
if diagnostic: logger.diag("CORE/preprocessor.gd","Parsing complete", false)
|
||||
return msg_proc
|
|
@ -10,11 +10,11 @@ config_version=5
|
|||
|
||||
[application]
|
||||
|
||||
config/name="CORE development project"
|
||||
run/main_scene="res://CORE/coreinit.tscn"
|
||||
config/name="CORE Framework"
|
||||
run/main_scene="res://Test.tscn"
|
||||
config/use_custom_user_dir=true
|
||||
config/custom_user_dir_name="core_devproject"
|
||||
config/features=PackedStringArray("4.1", "GL Compatibility")
|
||||
config/custom_user_dir_name="StarOpenSource/COREDev"
|
||||
config/features=PackedStringArray("4.2", "GL Compatibility")
|
||||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||
boot_splash/show_image=false
|
||||
|
||||
|
@ -23,6 +23,10 @@ boot_splash/show_image=false
|
|||
window/size/viewport_width=960
|
||||
window/size/viewport_height=540
|
||||
|
||||
[filesystem]
|
||||
|
||||
import/blender/enabled=false
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="gl_compatibility"
|
|
@ -1,3 +0,0 @@
|
|||
mkdocs
|
||||
mkdocs-material
|
||||
mkdocs-git-revision-date-localized-plugin
|
96
resmgr.gd
96
resmgr.gd
|
@ -1,96 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var logger: Node = null
|
||||
|
||||
# Loaded resources list
|
||||
var resources: Dictionary = {}
|
||||
|
||||
# Config
|
||||
var config_load_invalid_file_as_null: bool = false
|
||||
|
||||
# Loads a resource
|
||||
func loadres(resource_name:String,resource_path:String,replace:bool = false) -> int:
|
||||
if core.protection_mode: return 9223372036854775807
|
||||
logger.diag("CORE/resmgr.gd","Loading resource \"" + resource_name + "\" from path \"" + resource_path + "\" (replace=" + str(replace) + ")")
|
||||
if resources.has(resource_name):
|
||||
if replace:
|
||||
# If resource is already loaded and replace is true, remove it first (and then add it)
|
||||
resources.erase(resource_name)
|
||||
else:
|
||||
# If resource is already loaded and replace is false, throw an error
|
||||
var err = core.error("ResourceManager",core.Errors.RESOURCEMANAGER_ALREADY_EXISTS,{"name":resource_name})
|
||||
logger.error("CORE/resmgr.gd",err["error"])
|
||||
return err["code"]
|
||||
# Check if resource exists
|
||||
if !FileAccess.file_exists(resource_path):
|
||||
if config_load_invalid_file_as_null:
|
||||
resources.merge({resource_name:null})
|
||||
var err = core.error("ResourceManager",core.Errors.RESOURCEMANAGER_INVALID_FILEPATH,{"filepath":resource_path})
|
||||
logger.error("CORE/resmgr.gd",err["error"])
|
||||
return err["code"]
|
||||
# Load the resource
|
||||
var resource_loaded = ResourceLoader.load(resource_path)
|
||||
await get_tree().create_timer(0.05).timeout
|
||||
resources.merge({resource_name:resource_loaded})
|
||||
return core.Errors.OK
|
||||
|
||||
# Unloads a resource
|
||||
func unloadres(resource_name:String) -> int:
|
||||
if core.protection_mode: return 9223372036854775807
|
||||
if !resources.has(resource_name):
|
||||
# If resource is not loaded, throw an error
|
||||
var err = core.error("ResourceManager",core.Errors.RESOURCEMANAGER_RESOURCE_MISSING,{"name":resource_name})
|
||||
logger.error("CORE/resmgr.gd",err["error"])
|
||||
return err["code"]
|
||||
# Unload the resource
|
||||
resources.erase(resource_name)
|
||||
return core.Errors.OK
|
||||
|
||||
# Loads a batch of resources
|
||||
func loadbatch(batch:Dictionary,replace:bool = false) -> int:
|
||||
if core.protection_mode: return 9223372036854775807
|
||||
if batch == {}:
|
||||
# If batch is empty, throw an error
|
||||
var err = core.error("ResourceManager",core.Errors.RESOURCEMANAGER_BATCH_EMPTY)
|
||||
logger.error("CORE/resmgr.gd",err["error"])
|
||||
return err["code"]
|
||||
for i in batch:
|
||||
# Call loadres() method for every item in batch
|
||||
await loadres(i,batch[i],replace)
|
||||
return core.Errors.OK
|
||||
|
||||
# Unloads a batch of resources
|
||||
func unloadbatch(batch:Array) -> int:
|
||||
if core.protection_mode: return 9223372036854775807
|
||||
if batch == []:
|
||||
# If batch is empty, throw an error
|
||||
var err = core.error("ResourceManager",core.Errors.RESOURCEMANAGER_BATCH_EMPTY)
|
||||
logger.error("CORE/resmgr.gd",err["error"])
|
||||
return err["code"]
|
||||
for i in batch:
|
||||
# Call unloadres() method for every item in batch
|
||||
unloadres(i)
|
||||
return core.Errors.OK
|
||||
|
||||
# Returns a loaded resource
|
||||
# No return type is set because it can return literally everything.
|
||||
func getres(resource_name:String):
|
||||
if core.protection_mode: return null
|
||||
if !resources.has(resource_name):
|
||||
# Return null if resource is not loaded
|
||||
return null
|
||||
# Return the content
|
||||
return resources[resource_name]
|
211
smgr.gd
211
smgr.gd
|
@ -1,211 +0,0 @@
|
|||
######################################
|
||||
# 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: Node = null
|
||||
var logger: Node = null
|
||||
var resourcemanager: Node = null
|
||||
|
||||
# Overlays
|
||||
## The debug overlay
|
||||
var debug_overlay: Node = Node.new()
|
||||
var debug_overlay_scene: Dictionary = {}
|
||||
## The cutscene overlay
|
||||
var cutscene_overlay: Node = Node.new()
|
||||
var cutscene_overlay_scene: String = ""
|
||||
## The menu overlay
|
||||
var menu_overlay: Node = Node.new()
|
||||
var menu_overlay_scene: Dictionary = {}
|
||||
## The action overlay
|
||||
var action_overlay: Node = Node.new()
|
||||
var action_overlay_scene: String = ""
|
||||
|
||||
# Initializes the scene manager
|
||||
func initialize() -> void:
|
||||
if core.protection_mode: return
|
||||
logger.diag("CORE/smgr.gd","Constructing overlays")
|
||||
# Set overlay names
|
||||
debug_overlay.name = "DebugOverlay"
|
||||
cutscene_overlay.name = "CutsceneOverlay"
|
||||
menu_overlay.name = "MenuOverlay"
|
||||
action_overlay.name = "ActionOverlay"
|
||||
logger.diag("CORE/smgr.gd","Adding overlays")
|
||||
# Adds overlays to /root/
|
||||
get_tree().root.add_child(debug_overlay)
|
||||
get_tree().root.add_child(cutscene_overlay)
|
||||
get_tree().root.add_child(menu_overlay)
|
||||
get_tree().root.add_child(action_overlay)
|
||||
|
||||
# Adds a debug scene
|
||||
func add_debug(resource_name:String) -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Adding debug scene \"" + resource_name + "\"")
|
||||
# Load resource into memory
|
||||
var resource: Object = resourcemanager.getres(resource_name)
|
||||
if resource == null or resource.get_class() != "PackedScene":
|
||||
# If resource is null (not loaded) or is not a PackedScene, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_NOT_PACKEDSCENE,{"scene":resource_name,"overlay":"debug"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
if debug_overlay_scene.has(resource_name) and debug_overlay.get_children().has(resource):
|
||||
# If scene already exists, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"debug"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
resource = resource.instantiate()
|
||||
if !debug_overlay_scene.has(resource_name) and debug_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","debug_overlay_scene does not contain \"" + resource_name + "\" but debug_overlay does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
if debug_overlay_scene.has(resource_name) and !debug_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","debug_overlay does not contain \"" + resource_name + "\" but debug_overlay_scene does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
resource.name = resource_name
|
||||
debug_overlay.add_child(resource)
|
||||
debug_overlay_scene.merge({resource_name:resource},true)
|
||||
return core.Errors.OK
|
||||
|
||||
# Adds a menu scene
|
||||
func add_menu(resource_name:String) -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Adding menu scene \"" + resource_name + "\"")
|
||||
# Load resource into memory
|
||||
var resource: Object = resourcemanager.getres(resource_name)
|
||||
if resource == null or resource.get_class() != "PackedScene":
|
||||
# If resource is null (not loaded) or is not a PackedScene, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_NOT_PACKEDSCENE,{"scene":resource_name,"overlay":"menu"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
if menu_overlay_scene.has(resource_name) and menu_overlay.get_children().has(resource):
|
||||
# If resource is null (not loaded) or is not a PackedScene, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"menu"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
resource = resource.instantiate()
|
||||
if !menu_overlay_scene.has(resource_name) and menu_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","menu_overlay_scene does not contain \"" + resource_name + "\" but menu_overlay does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
if menu_overlay_scene.has(resource_name) and !menu_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","menu_overlay does not contain \"" + resource_name + "\" but menu_overlay_scene does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
resource.name = resource_name
|
||||
menu_overlay.add_child(resource)
|
||||
menu_overlay_scene.merge({resource_name:resource},true)
|
||||
return core.Errors.OK
|
||||
|
||||
# Adds a cutscene scene
|
||||
func add_cutscene(resource_name:String) -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Adding cutscene scene \"" + resource_name + "\"")
|
||||
# Load resource into memory
|
||||
var resource: Object = resourcemanager.getres(resource_name)
|
||||
if resource == null or resource.get_class() != "PackedScene":
|
||||
# If resource is null (not loaded) or is not a PackedScene, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_NOT_PACKEDSCENE,{"scene":resource_name,"overlay":"cutscene"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
if cutscene_overlay_scene == resource_name and cutscene_overlay.get_children().has(resource):
|
||||
# If resource is null (not loaded) or is not a PackedScene, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"cutscene"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
resource = resource.instantiate()
|
||||
if cutscene_overlay_scene != resource_name and cutscene_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","cutscene_overlay_scene does not contain \"" + resource_name + "\" but cutscene_overlay does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
if cutscene_overlay_scene == resource_name and !cutscene_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","cutscene_overlay does not contain \"" + resource_name + "\" but cutscene_overlay_scene does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
resource.name = resource_name
|
||||
cutscene_overlay.add_child(resource)
|
||||
cutscene_overlay_scene = resource_name
|
||||
return core.Errors.OK
|
||||
|
||||
# Adds a action scene
|
||||
func add_action(resource_name:String) -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Adding action scene \"" + resource_name + "\"")
|
||||
# Load resource into memory
|
||||
var resource = resourcemanager.getres(resource_name)
|
||||
if resource == null or typeof(resource) != TYPE_OBJECT or resource.get_class() != "PackedScene":
|
||||
# If resource is null (not loaded) or is not a PackedScene, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_NOT_PACKEDSCENE,{"scene":resource_name,"overlay":"action"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
if action_overlay_scene == resource_name and action_overlay.get_children().has(resource):
|
||||
# If resource is null (not loaded) or is not a PackedScene, throw an error
|
||||
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"action"})
|
||||
logger.error("CORE/smgr.gd",err["error"])
|
||||
return err["code"]
|
||||
resource = resource.instantiate()
|
||||
if action_overlay_scene != resource_name and action_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","action_overlay_scene does not contain \"" + resource_name + "\" but action_overlay does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
if action_overlay_scene == resource_name and !action_overlay.get_children().has(resource):
|
||||
core.exception("SceneManager","action_overlay does not contain \"" + resource_name + "\" but action_overlay_scene does")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
resource.name = resource_name
|
||||
action_overlay.add_child(resource)
|
||||
action_overlay_scene = resource_name
|
||||
return core.Errors.OK
|
||||
|
||||
func remove_debug(resource_name:String) -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Removing debug scene \"" + resource_name + "\"")
|
||||
for child in debug_overlay.get_children():
|
||||
if child.name == resource_name:
|
||||
debug_overlay.remove_child(child)
|
||||
break
|
||||
else:
|
||||
core.exception("SceneManager","Could not remove \"" + resource_name + "\" from the debug overlay as debug_overlay does have a child with that name")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
debug_overlay_scene.erase(resource_name)
|
||||
return core.Errors.OK
|
||||
|
||||
func remove_cutscene() -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Removing cutscene scene \"" + cutscene_overlay_scene + "\"")
|
||||
for child in cutscene_overlay.get_children():
|
||||
if child.name == cutscene_overlay_scene:
|
||||
cutscene_overlay.remove_child(child)
|
||||
break
|
||||
else:
|
||||
core.exception("SceneManager","Could not remove \"" + cutscene_overlay_scene + "\" from the cutscene overlay as cutscene_overlay does have a child with that name")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
cutscene_overlay_scene = ""
|
||||
return core.Errors.OK
|
||||
|
||||
func remove_menu(resource_name:String) -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Removing menu scene \"" + resource_name + "\"")
|
||||
for child in menu_overlay.get_children():
|
||||
if child.name == resource_name:
|
||||
menu_overlay.remove_child(child)
|
||||
break
|
||||
else:
|
||||
core.exception("SceneManager","Could not remove \"" + resource_name + "\" from the menu overlay as menu_overlay does have a child with that name")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
menu_overlay_scene.erase(resource_name)
|
||||
return core.Errors.OK
|
||||
|
||||
func remove_action() -> int:
|
||||
if core.protection_mode: return core.Errors.CORE_PROTECTIONMODE
|
||||
logger.diag("CORE/smgr.gd","Removing action scene \"" + cutscene_overlay_scene + "\"")
|
||||
for child in action_overlay.get_children():
|
||||
if child.name == cutscene_overlay_scene:
|
||||
action_overlay.remove_child(child)
|
||||
break
|
||||
else:
|
||||
core.exception("SceneManager","Could not remove \"" + cutscene_overlay_scene + "\" from the action overlay as action_overlay does have a child with that name")
|
||||
return core.Errors.CORE_EXCEPTION
|
||||
action_overlay_scene = ""
|
||||
return core.Errors.OK
|
Binary file not shown.
Before Width: | Height: | Size: 168 KiB |
45
splash.gd
45
splash.gd
|
@ -1,45 +0,0 @@
|
|||
######################################
|
||||
# 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
|
34
splash.tscn
34
splash.tscn
|
@ -1,34 +0,0 @@
|
|||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://CORE/splash.gd" id="1_n4sar"]
|
||||
[ext_resource type="Texture2D" path="res://CORE/soscore.png" id="2_5krj5"]
|
||||
|
||||
[node name="SplashScreen" 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")
|
35
src/classes/basemodule.gd
Normal file
35
src/classes/basemodule.gd
Normal file
|
@ -0,0 +1,35 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/classes/basemodule.gd (CORE Base Module) ###
|
||||
### ###
|
||||
### This source file is a basic CORE module template. It provides ###
|
||||
### common functions and variables for all CORE modules. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
class_name CoreBaseModule
|
||||
|
||||
# CORE Object
|
||||
var core: Core
|
||||
# CORE's logger implementation
|
||||
@onready var logger: Node = core.logger
|
||||
|
||||
# Replacement for _init()
|
||||
func _initialize() -> void: pass
|
||||
# Called on configuration update
|
||||
func _pull_config() -> void: pass
|
57
src/classes/config.gd
Normal file
57
src/classes/config.gd
Normal file
|
@ -0,0 +1,57 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/classes/config.gd (CORE Configuration) ###
|
||||
### ###
|
||||
### This source file contains the default configuration for the CORE ###
|
||||
### Framework. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
class_name CoreConfiguration
|
||||
|
||||
@export_category("Global")
|
||||
@export var headless: bool
|
||||
@export_category("Debugging")
|
||||
@export var debug_allow: bool
|
||||
@export_category("Logger")
|
||||
@export var logger_level: CoreTypes.LoggerLevel
|
||||
@export var logger_colored: bool
|
||||
@export var logger_format: String
|
||||
@export var logger_newlines_override: bool
|
||||
@export var logger_newlines_sizelimit: int
|
||||
@export_category("LogUI")
|
||||
@export var logui_background: bool
|
||||
@export var logui_background_color: Color
|
||||
@export var logui_font_size: int
|
||||
|
||||
# Default settings
|
||||
func _init() -> void:
|
||||
# Global
|
||||
headless = false
|
||||
# Debugging
|
||||
debug_allow = false
|
||||
# Logger
|
||||
logger_level = CoreTypes.LoggerLevel.INFO
|
||||
logger_colored = true
|
||||
logger_format = "%color%[%time%] [%level% %source%:%line%] %message%"
|
||||
logger_newlines_override = true
|
||||
logger_newlines_sizelimit = 40
|
||||
# LogUI
|
||||
logui_background = true
|
||||
logui_background_color = Color.BLACK
|
||||
logui_font_size = 14
|
28
src/classes/types.gd
Normal file
28
src/classes/types.gd
Normal file
|
@ -0,0 +1,28 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/classes/types.gd (CORE Global Types) ###
|
||||
### ###
|
||||
### This source file contains globally accessible custom enums and types ###
|
||||
### used throughout the CORE Framework's source code. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
class_name CoreTypes
|
||||
|
||||
enum VersionType { RELEASE, RELEASECANDIDATE, BETA, ALPHA }
|
||||
enum LoggerLevel { NONE, ERROR, WARN, INFO, VERB, DIAG }
|
154
src/core.gd
Normal file
154
src/core.gd
Normal file
|
@ -0,0 +1,154 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/core.gd (CORE Object) ###
|
||||
### ###
|
||||
### This source file is responsible for initializing CORE's modules, ###
|
||||
### handling communication between them and much more. ###
|
||||
##############################################################################
|
||||
extends Node
|
||||
class_name Core
|
||||
|
||||
# Constants
|
||||
const version_release: int = 1
|
||||
const version_type: CoreTypes.VersionType = CoreTypes.VersionType.ALPHA
|
||||
const version_typerelease: int = 0
|
||||
|
||||
# Modules
|
||||
var config: CoreConfiguration
|
||||
var logger: CoreBaseModule
|
||||
var misc: CoreBaseModule
|
||||
var logui: CoreBaseModule
|
||||
|
||||
# Variables
|
||||
var basepath: String
|
||||
|
||||
# Preinitialization
|
||||
func _init(new_config: CoreConfiguration = CoreConfiguration.new()) -> void:
|
||||
name = "CORE"
|
||||
if !determine_basepath(): queue_free()
|
||||
reload_configuration(new_config)
|
||||
initialize_modules()
|
||||
apply_configuration()
|
||||
|
||||
# Initialization
|
||||
func _ready() -> void:
|
||||
inject_modules()
|
||||
logger.info("Initialized CORE successfully")
|
||||
if is_devmode(): logger.warn("The CORE Framework is in development mode. Here be dragons!")
|
||||
if config.headless: logger.warn("CORE is in headless mode. Certain modules will not work as expected.")
|
||||
|
||||
# Initialize modules
|
||||
func initialize_modules() -> void:
|
||||
# Create Nodes
|
||||
logger = CoreBaseModule.new()
|
||||
misc = CoreBaseModule.new()
|
||||
logui = CoreBaseModule.new()
|
||||
# Set names
|
||||
logger.name = "Logger"
|
||||
misc.name = "Misc"
|
||||
logui.name = "LogUI"
|
||||
# Set scripts
|
||||
logger.set_script(ResourceLoader.load(basepath + "src/logger.gd"))
|
||||
misc.set_script(ResourceLoader.load(basepath + "src/misc.gd"))
|
||||
logui.set_script(ResourceLoader.load(basepath + "src/logui.gd"))
|
||||
# Set reference to self
|
||||
logger.core = self
|
||||
misc.core = self
|
||||
logui.core = self
|
||||
# Call _initialize() (workaround as modules cannot access "core" during _init())
|
||||
logger._initialize()
|
||||
misc._initialize()
|
||||
logui._initialize()
|
||||
|
||||
# Inject modules into the SceneTree
|
||||
func inject_modules() -> void:
|
||||
add_child(logger)
|
||||
add_child(misc)
|
||||
add_child(logui)
|
||||
|
||||
# (Re-)Load configuration
|
||||
func reload_configuration(new_config: CoreConfiguration = CoreConfiguration.new()) -> void:
|
||||
var initialized = config != null
|
||||
if initialized: logger.info("Reloading CORE's configuration")
|
||||
config = new_config
|
||||
if is_devmode(): # Override configuration in development mode
|
||||
config.logger_level = CoreTypes.LoggerLevel.VERB
|
||||
if initialized: apply_configuration()
|
||||
|
||||
# Call _pull_config() functions
|
||||
func apply_configuration() -> void:
|
||||
logger._pull_config()
|
||||
misc._pull_config()
|
||||
logui._pull_config()
|
||||
|
||||
# Determines CORE's installation/base path
|
||||
func determine_basepath() -> bool:
|
||||
if FileAccess.file_exists("res://.corebasepath"):
|
||||
basepath = "res://"
|
||||
elif FileAccess.file_exists("res://CORE/.corebasepath"):
|
||||
basepath = "res://CORE/"
|
||||
elif FileAccess.file_exists("res://addons/CORE/.corebasepath"):
|
||||
basepath = "res://addons/CORE/"
|
||||
else:
|
||||
assert(false, "CORE is not located at 'res://CORE/', aborting initialization")
|
||||
return false
|
||||
return true
|
||||
|
||||
# Return development mode status
|
||||
func is_devmode() -> bool:
|
||||
return config.debug_allow and basepath == "res://" and OS.is_debug_build()
|
||||
|
||||
# Replaces variables with human-friendly strings
|
||||
func get_formatted_string(string: String) -> String:
|
||||
# Version strings
|
||||
string = string.replace("%release%", str(version_release))
|
||||
string = string.replace("%release_type%", str(version_typerelease))
|
||||
var semantic_version: Array[int] = get_version_semantic()
|
||||
string = string.replace("%release_semantic%", str(semantic_version[0]) + "." + str(semantic_version[1]) + "." + str(semantic_version[2]))
|
||||
match(version_type):
|
||||
CoreTypes.VersionType.RELEASE:
|
||||
string = string.replace("%type%", "Release")
|
||||
string = string.replace("%type_technical%", "r")
|
||||
CoreTypes.VersionType.RELEASECANDIDATE:
|
||||
string = string.replace("%type%", "Release Candidate")
|
||||
string = string.replace("%type_technical%", "rc")
|
||||
CoreTypes.VersionType.BETA:
|
||||
string = string.replace("%type%", "Beta")
|
||||
string = string.replace("%type_technical%", "b")
|
||||
CoreTypes.VersionType.ALPHA:
|
||||
string = string.replace("%type%", "Alpha")
|
||||
string = string.replace("%type_technical%", "a")
|
||||
_: await logger.crash("Invalid version type " + str(version_type))
|
||||
# Development mode
|
||||
if is_devmode(): string = string.replace("%devmode%", "Enabled")
|
||||
else: string = string.replace("%devmode%", "Disabled")
|
||||
# Headless mode
|
||||
if config.headless: string = string.replace("%headless%", "Enabled")
|
||||
else: string = string.replace("%headless%", "Disabled")
|
||||
return string
|
||||
|
||||
# Return CORE's version in the semantic versioning scheme
|
||||
func get_version_semantic() -> Array[int]:
|
||||
var version_type_int: int
|
||||
match(version_type):
|
||||
CoreTypes.VersionType.RELEASE: version_type_int = 3
|
||||
CoreTypes.VersionType.RELEASECANDIDATE: version_type_int = 2
|
||||
CoreTypes.VersionType.BETA: version_type_int = 1
|
||||
CoreTypes.VersionType.ALPHA: version_type_int = 0
|
||||
return [version_release, version_type_int, version_typerelease]
|
108
src/logger.gd
Normal file
108
src/logger.gd
Normal file
|
@ -0,0 +1,108 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/logger.gd (Logger implementation) ###
|
||||
### ###
|
||||
### Prints formatted strings into the console/log. ###
|
||||
##############################################################################
|
||||
extends CoreBaseModule
|
||||
|
||||
# Signals
|
||||
signal log_event
|
||||
|
||||
# Configuration
|
||||
var config_level: CoreTypes.LoggerLevel
|
||||
var config_colored: bool
|
||||
var config_format: String
|
||||
var config_newlines_override: bool
|
||||
var config_newlines_sizelimit: int
|
||||
|
||||
# Update configuration
|
||||
func _pull_config() -> void:
|
||||
config_level = core.config.logger_level
|
||||
config_colored = core.config.logger_colored
|
||||
config_format = core.config.logger_format
|
||||
config_newlines_override = core.config.logger_newlines_override
|
||||
config_newlines_sizelimit = core.config.logger_newlines_sizelimit
|
||||
|
||||
# Creates log messages
|
||||
func _log(level: CoreTypes.LoggerLevel, message: String) -> void:
|
||||
var origin: Dictionary = get_origin()
|
||||
if !is_level_allowed(level):
|
||||
emit_signal("log_event", false, level, origin, message, "")
|
||||
return
|
||||
var format: String = config_format
|
||||
format = format.replace("%time_ms%", str(Time.get_ticks_msec()))
|
||||
format = format.replace("%time%", Time.get_time_string_from_system(true))
|
||||
format = format.replace("%source%", origin["source_clean"])
|
||||
format = format.replace("%source_raw%", origin["source"])
|
||||
format = format.replace("%function%", origin["function"])
|
||||
format = format.replace("%line%", str(origin["line"]))
|
||||
var format_newline: String = format.replace("%color%", "").replace("%message%", "")
|
||||
if !config_colored: format = format.replace("%color%", "")
|
||||
match(level):
|
||||
CoreTypes.LoggerLevel.DIAG:
|
||||
format = format.replace("%level%", "DIAG")
|
||||
format_newline = format_newline.replace("%level%", "DIAG")
|
||||
format.replace("%color%", "[color=dark_gray]")
|
||||
CoreTypes.LoggerLevel.VERB:
|
||||
format = format.replace("%level%", "VERB")
|
||||
format_newline = format_newline.replace("%level%", "VERB")
|
||||
format = format.replace("%color%", "[color=gray]")
|
||||
CoreTypes.LoggerLevel.INFO:
|
||||
format = format.replace("%level%", "INFO")
|
||||
format_newline = format_newline.replace("%level%", "INFO")
|
||||
format = format.replace("%color%", "[color=white]")
|
||||
CoreTypes.LoggerLevel.WARN:
|
||||
format = format.replace("%level%", "WARN")
|
||||
format_newline = format_newline.replace("%level%", "WARN")
|
||||
format = format.replace("%color%", "[color=yellow]")
|
||||
CoreTypes.LoggerLevel.ERROR:
|
||||
format = format.replace("%level%", "ERR!")
|
||||
format_newline = format_newline.replace("%level%", "ERR!")
|
||||
format = format.replace("%color%", "[color=red]")
|
||||
CoreTypes.LoggerLevel.NONE:
|
||||
format = format.replace("%level%", "NONE")
|
||||
format_newline = format_newline.replace("%level%", "NONE")
|
||||
format = format.replace("%color%", "[color=black]")
|
||||
# Replace %message%
|
||||
if config_newlines_override and config_newlines_sizelimit <= -1 or format_newline.length() <= config_newlines_sizelimit: message = message.replace("\n", "\n" + " ".repeat(format_newline.length()))
|
||||
format = format.replace("%message%", message)
|
||||
emit_signal("log_event", true, level, origin, message, format)
|
||||
if config_colored: print_rich(format)
|
||||
else: print(format)
|
||||
|
||||
# Get function caller
|
||||
func get_origin() -> Dictionary:
|
||||
var stack: Dictionary = get_stack()[3]
|
||||
return { "source": stack["source"], "source_clean": stack["source"].replace("res://", "").replace("user://", ""), "function": stack["function"], "line": stack["line"] }
|
||||
|
||||
# Check if level is allowed
|
||||
func is_level_allowed(level: CoreTypes.LoggerLevel) -> bool:
|
||||
if level <= config_level: return true
|
||||
else: return false
|
||||
|
||||
# Self explanitory
|
||||
func diag(message: String) -> void: _log(CoreTypes.LoggerLevel.DIAG, message)
|
||||
func verb(message: String) -> void: _log(CoreTypes.LoggerLevel.VERB, message)
|
||||
func info(message: String) -> void: _log(CoreTypes.LoggerLevel.INFO, message)
|
||||
func warn(message: String) -> void: _log(CoreTypes.LoggerLevel.WARN, message)
|
||||
func error(message: String) -> void: _log(CoreTypes.LoggerLevel.ERROR, message)
|
||||
func crash(_message: String) -> void:
|
||||
await get_tree().process_frame
|
||||
error("crash() isn't implemented yet")
|
89
src/logui.gd
Normal file
89
src/logui.gd
Normal file
|
@ -0,0 +1,89 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/logui.gd (LogUI) ###
|
||||
### ###
|
||||
### Displays the log/console output graphically. ###
|
||||
##############################################################################
|
||||
extends CoreBaseModule
|
||||
|
||||
# Objects
|
||||
var background: ColorRect
|
||||
var logrtl: RichTextLabel
|
||||
|
||||
# Resources
|
||||
var font_normal: Font
|
||||
var font_bold: Font
|
||||
|
||||
func _initialize() -> void:
|
||||
# Load fonts into memory
|
||||
font_normal = ResourceLoader.load(core.basepath + "dist/FiraCode/Regular.ttf")
|
||||
font_bold = ResourceLoader.load(core.basepath + "dist/FiraCode/Bold.ttf")
|
||||
# Create LogUI
|
||||
background = ColorRect.new()
|
||||
background.name = "LogUI"
|
||||
# Create LogRTL
|
||||
logrtl = RichTextLabel.new()
|
||||
logrtl.name = "LogRTL"
|
||||
logrtl.bbcode_enabled = true
|
||||
## Interaction
|
||||
logrtl.selection_enabled = false
|
||||
logrtl.deselect_on_focus_loss_enabled = true
|
||||
logrtl.drag_and_drop_selection_enabled = false
|
||||
logrtl.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
## Scrolling
|
||||
logrtl.scroll_active = true
|
||||
logrtl.scroll_following = true
|
||||
## Disable localization
|
||||
logrtl.auto_translate = false
|
||||
logrtl.localize_numeral_system = false
|
||||
## Override fonts
|
||||
logrtl.add_theme_font_override("normal_font", font_normal)
|
||||
logrtl.add_theme_font_override("bold_font", font_bold)
|
||||
logrtl.add_theme_font_size_override("normal_font_size", 14)
|
||||
logrtl.add_theme_font_size_override("bold_font_size", 14)
|
||||
|
||||
func _pull_config() -> void:
|
||||
background.visible = !core.config.headless
|
||||
if core.config.logui_background: background.self_modulate.a = 1
|
||||
else: background.self_modulate.a = 0
|
||||
background.color = core.config.logui_background_color
|
||||
logrtl.add_theme_font_size_override("normal_font_size", core.config.logui_font_size)
|
||||
logrtl.add_theme_font_size_override("bold_font_size", core.config.logui_font_size)
|
||||
|
||||
func _ready() -> void:
|
||||
# Add to SceneTree
|
||||
add_child(background)
|
||||
background.add_child(logrtl)
|
||||
# Hide VScrollBar
|
||||
var vsbar: VScrollBar = logrtl.get_child(0, true)
|
||||
vsbar.set_deferred("size", Vector2i(1, 1))
|
||||
vsbar.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
vsbar.add_theme_stylebox_override("scroll", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("scroll_focus", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("grabber", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("grabber_highlight", StyleBoxEmpty.new())
|
||||
vsbar.add_theme_stylebox_override("grabber_pressed", StyleBoxEmpty.new())
|
||||
# Connect log_event
|
||||
logger.connect("log_event", func(allowed: bool, _level: CoreTypes.LoggerLevel, _origin: Dictionary, _message: String, format: String) -> void: if allowed: logrtl.text = logrtl.text + format + "\n")
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if !core.config.headless:
|
||||
var window_size: Vector2i = DisplayServer.window_get_size()
|
||||
background.size = window_size
|
||||
logrtl.size = window_size
|
29
src/misc.gd
Normal file
29
src/misc.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
##############################################################################
|
||||
### CORE FRAMEWORK SOURCE FILE ###
|
||||
### Copyright (c) 2024 The StarOpenSource Project & Contributors ###
|
||||
### Licensed under the GNU General Public License v3 ###
|
||||
### ###
|
||||
### This program is free software: you can redistribute it and/or modify ###
|
||||
### it under the terms of the GNU General Public License as published by ###
|
||||
### the Free Software Foundation, either version 3 of the License, or ###
|
||||
### (at your option) any later version. ###
|
||||
### ###
|
||||
### This program is distributed in the hope that it will be useful, ###
|
||||
### but WITHOUT ANY WARRANTY; without even the implied warranty of ###
|
||||
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ###
|
||||
### GNU General Public License for more details. ###
|
||||
### ###
|
||||
### You should have received a copy of the GNU General Public License ###
|
||||
### along with this program. If not, see <https://www.gnu.org/licenses/>. ###
|
||||
##############################################################################
|
||||
### src/misc.gd (Miscellaneous) ###
|
||||
### ###
|
||||
### Contains various functions that don't fit into other modules. ###
|
||||
##############################################################################
|
||||
extends CoreBaseModule
|
||||
|
||||
func quit_safely(exitcode: int = 0) -> void:
|
||||
logger.info("Shutting down (code " + str(exitcode) + ")")
|
||||
logger.diag("Waiting for log messages to be flushed")
|
||||
await get_tree().create_timer(0.25).timeout
|
||||
get_tree().quit(exitcode)
|
Loading…
Reference in a new issue