Update documentation

This commit is contained in:
JeremyStar™ 2024-02-10 21:21:38 +01:00
parent d3fcdb63fa
commit 4e65b2715a
17 changed files with 322 additions and 45 deletions

View file

@ -14,6 +14,6 @@ If you want to use the CORE Framework in a new project, then your answer is **ye
## Roadmap
- [x] Configuration support
- [x] Logger implementation
- [ ] HTTP Request helper
- [x] HTTP Request helper
- [ ] Mod Loader
- [x] Support for custom modules

View file

@ -0,0 +1,8 @@
{
"label": "Getting started",
"position": 3,
"link": {
"type": "generated-index",
"description": "Helps you get CORE set up in your project."
}
}

View file

@ -0,0 +1,45 @@
---
sidebar_position: 2
description: CORE needs to be initialized before usage.
---
# Initializing CORE
Before you can use the CORE Framework, you'll need to initialize it.
This example should explain everything:
```gdscript
extends Node
# CORE Object
var core: Core
# CORE Logger
## Will be defined before _ready() is called
@onready var logger: CoreBaseModule = core.logger
func _init() -> void:
# Create new CoreConfiguration
var config: CoreConfiguration = CoreConfiguration.new()
# Set logger level to DIAG
config.logger_level = CoreTypes.LoggerLevel.DIAG
# Initialize CORE with custom configuration
core = Core.new(config)
# Initialize CORE with standard configuration
#core = Core.new()
func _ready() -> void:
# Initialize CORE completely
await get_tree().process_frame # to avoid "setting up nodes" error
get_tree().root.add_child(core) # add CORE Object to SceneTree
await get_tree().process_frame # wait for CORE to initialize completely
# >>> Your code should start executing here <<<<
# Print "Hello World!" to console with all possible 'LoggerLevel''s
for type in CoreTypes.LoggerLevel:
if type == "NONE": continue # Exclude "NONE" logger level
type = StringName(type.to_lower()) # Convert to StringName
logger.call(type, "Hello World!") # Call it
# Test crash
logger.crash("This is a test crash.")
```

View file

@ -0,0 +1,124 @@
---
sidebar_position: 1
---
# Setting up
```mdx-code-block
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
```
This helps you install the CORE Framework in the first place.
## Using the Godot Asset Library
:::note
This will install the CORE Framework without the ability to easily download updates. You will need to look for updates yourself and install the latest version from the Asset Library yourself. If you don't want that hassle, use a [git installation](#using-git) instead.
:::
This will install the latest *stable* version.
1. Open your project in the Godot Editor and click on the **AssetLib** tab
2. Search for `CORE Framework`
3. Click on the first result and hit **Install**
4. Follow the usual asset installation procedure
## Using git
Using git to manage a CORE installation is a bit harder than [using Godot's Asset Library](#using-the-godot-asset-library), but comes with more advantages. One of them being able to switch branches or trying out experimental features.
:::note
You'll need to all commands in your project root.
:::
### Installing CORE
<Tabs groupId="git">
<TabItem value="direct-develop" label="Develop branch">
```bash
git clone https://git.staropensource.de/StarOpenSource/CORE.git CORE
```
</TabItem>
<TabItem value="direct-stable" label="Stable branch" default>
```bash
git clone https://git.staropensource.de/StarOpenSource/CORE.git CORE
cd CORE
git checkout stable
```
</TabItem>
<TabItem value="submodule-develop" label="Develop branch (submodule)">
```bash
git submodule add https://git.staropensource.de/StarOpenSource/CORE.git CORE
```
</TabItem>
<TabItem value="submodule-stable" label="Stable branch (submodule)">
```bash
git submodule add https://git.staropensource.de/StarOpenSource/CORE.git CORE
cd CORE
git checkout stable
```
</TabItem>
</Tabs>
### Updating CORE
<Tabs groupId="git">
<TabItem value="direct-develop" label="Develop branch">
```bash
cd CORE
git pull
```
</TabItem>
<TabItem value="direct-stable" label="Stable branch" default>
```bash
cd CORE
git pull
```
</TabItem>
<TabItem value="submodule-develop" label="Develop branch (submodule)">
```bash
cd CORE
git pull origin develop
cd ..
git submodule update
```
</TabItem>
<TabItem value="submodule-stable" label="Stable branch (submodule)">
```bash
cd CORE
git pull origin develop
cd ..
git submodule update
```
</TabItem>
</Tabs>
## Changing branches
:::warning
Changing branches can result in errors and missing features. We don't accept issues regarding switching branches, you will be on your own!
:::
<Tabs groupId="git-branch">
<TabItem value="direct-develop2stable" label="Develop » Stable">
```bash
cd CORE
git fetch
git checkout stable
```
</TabItem>
<TabItem value="direct-stable2develop" label="Stable » Develop" default>
```bash
cd CORE
git fetch
git checkout develop
```
</TabItem>
<TabItem value="submodule-develop2stable" label="Develop » Stable (submodule)">
```bash
cd CORE
git fetch
git checkout stable
cd ..
git submodule update
```
</TabItem>
<TabItem value="submodule-stable2develop" label="Stable » Develop (submodule)">
```bash
cd CORE
git fetch
git checkout develop
cd ..
git submodule update
```
</TabItem>
</Tabs>

View file

@ -1,8 +1,8 @@
{
"label": "Reference",
"position": 3,
"position": 4,
"link": {
"type": "generated-index",
"description": "Documentation about CORE's internals"
"description": "CORE Framework module documentation"
}
}

View file

@ -1,8 +0,0 @@
{
"label": "API",
"position": 1,
"link": {
"type": "generated-index",
"description": "CORE Framework module documentation"
}
}

View file

@ -1,13 +0,0 @@
---
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.

View file

@ -9,7 +9,7 @@ The **CORE Object** is the class you use to initialize the CORE Framework.
### *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.
CORE's release type. See [`CoreTypes.VersionType`](/reference/coretypes#versiontype) for more information.
### *int* <u>version_typerelease</u>
CORE's typerelease number
@ -27,8 +27,10 @@ Stores the path to CORE's installation directory.
## Functions
### *void* <u>_init</u>(*CoreConfiguration* <u>new_config</u>)
Determines the base path, loads the configuration file and initializes all modules.
### *void* <u>register_custom_module</u>(*String* <u>module_name</u>, *CoreBaseModule* <u>module_class</u>)
### *bool* <u>register_custom_module</u>(*String* <u>module_name</u>, *CoreBaseModule* <u>module_class</u>)
Registers a custom module.
Returns `true` if successful.
### *void* <u>unregister_custom_module</u>(*String* <u>module_name</u>)
Unregisters a custom module.
### *CoreBaseModule* <u>get_custom_module</u>(*String* <u>module_name</u>)

View file

@ -4,15 +4,20 @@ sidebar_position: 5
# `CoreConfiguration`
Provides the default configuration for the CORE Framework.
## Note
All settings are variables.
## Variables
## Global
### *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*
### *bool* <u>debugging</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`.
### *bool* <u>custom_modules</u> = *false*
Allows or disallows custom modules.
## Logger
### *CoreTypes.LoggerLevel* <u>logger_level</u> = *CoreTypes.LoggerLevel.INFO*
I don't have to explain this, do I?
### *bool* <u>logger_colored</u> = *true*
@ -32,9 +37,10 @@ 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.
## LogUI
### *bool* <u>logui_enabled</u> = *true*
Determines if [`LogUI`](/terminology#logui) should be visible or not.
### *Color* <u>logui_background_color</u> = *Color.BLACK*
The color the `LogUI` background will have.
The color the `LogUI` background will have. Set to `Color.TRANSPARENT` for a transparent background.
### *int* <u>logui_font_size</u> = *14*
The font size the graphical log output should have.

View file

@ -10,3 +10,5 @@ Contains globaly accessible custom enums and types used throughout the CORE Fram
RELEASE, RELEASECANDIDATE, BETA, ALPHA
### <u>LoggerLevel</u>
NONE, ERROR, WARN, INFO, VERB, DIAG
### <u>SceneType</u>
NONE, DEBUG, CUTSCENE, MENU, MAIN, BACKGROUND

View file

@ -0,0 +1,36 @@
---
sidebar_position: 7
---
# `Easy DownLoader`
Pulls files from the internet, awaitable and batchable.
## Functions
### *Dictionary* <u>awaited_request</u>(*String* <u>url</u>, *HTTPClient.Method* <u>method</u> = *HTTPClient.Method.METHOD_GET*, *PackedStringArray* <u>headers</u> = *PackedStringArray([])*, *String* <u>data</u> = *""*)
Requests a file from the internet, awaitable.
The returned `Dictionary` has the following structure (example):
```gdscript
{ "result": 0, "http_code": 200, "headers": [ "Server": "nginx" ], "body": [], "body_utf8": [] }
^ ^ ^ ^ ^
| | | | |
| | | | --------- The body from the server, as a UTF-8 string
| | | ----------------------- The body from the server, as bytes
| | ------------------------------------------------------ A array of headers
| ---------------------------------------------------------------------- The HTTP response code
------------------------------------------------------------------------------------ Equal to @GlobalScope.Error. If not 0/Error.OK = the request failed
```
### *Array[Dictionary]* <u>batch_awaited_request</u>(*PackedStringArray* <u>urls</u>, *HTTPClient.Method* <u>method</u> = *HTTPClient.Method.METHOD_GET*, *PackedStringArray* <u>headers</u> = *PackedStringArray([])*, *String* <u>data</u> = *""*)
Requests multiple file from the internet, awaitable.
The returned `Dictionary`s have the following structure (example):
```gdscript
{ "result": 0, "http_code": 200, "headers": [ "Server": "nginx" ], "body": [], "body_utf8": [] }
^ ^ ^ ^ ^
| | | | |
| | | | --------- The body from the server, as a UTF-8 string
| | | ----------------------- The body from the server, as bytes
| | ------------------------------------------------------ A array of headers
| ---------------------------------------------------------------------- The HTTP response code
------------------------------------------------------------------------------------ Equal to @GlobalScope.Error. If not 0/Error.OK = the request failed
```

View file

@ -26,8 +26,11 @@ Prints a informational message
Prints a warning message
### *void* <u>error</u>(*String* <u>message</u>)
Prints an error message
### *void* <u>crash</u>(*String* <u>message</u>)
### *void* <u>crash</u>(*String* <u>message</u>, *bool* <u>framework_crash</u> = *false*)
:::note[Awaiting required]
Using the `await` keyword is required for this function.
:::
:::danger
Please do not set `framework_crash` to `true`. Thank you.
:::
Handles crashes. Will terminate your game/application immediately.

View file

@ -0,0 +1,29 @@
---
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.
### *float* <u>byte2mib</u>(*int* <u>bytes</u>, *bool* flatten = *true*)
Converts a number of bytes to mebibytes.
If `flatten` is set to `true`, the decimal part will be discarded.
### *float* <u>mib2byte</u>(*float* <u>mib</u>, *bool* <u>flatten</u> = *true*)
Converts a number of mebibytes to bytes.
If `flatten` is set to `true`, the decimal part will be discarded.
### *float* <u>mib2gib</u>(*float* <u>mib</u>, *bool* flatten = *true*)
Converts a number of mebibytes to gibibytes.
If `flatten` is set to `true`, the decimal part will be discarded.
### *float* <u>gib2mib</u>(*float* <u>gib</u>, *bool* <u>flatten</u> = *true*)
Converts a number of gibibytes to mebibytes.
If `flatten` is set to `true`, the decimal part will be discarded.

View file

@ -0,0 +1,39 @@
---
sidebar_position: 6
---
# `Scene Management System`
Handles scenes and their order.
## Functions
### *bool* <u>add_scene</u>(*String* <u>sname</u>, *CoreTypes.SceneType* <u>type</u>, *Node* <u>sclass</u>)
Adds a scene to some scene collection.
Returns `true` if successful.
### *bool* <u>remove_scene</u>(*String* <u>sname</u>, *bool* <u>force_remove</u> = *false*)
:::danger
Please do not set `force_remove` to `true`. Thank you.
:::
Removes a scene from some scene collection.
Returns `true` if successful.
## *Node* <u>get_scene</u>(*String* <u>sname</u>)
Returns a scene from some scene collection.
Returns `null` if no scene with that name was found.
## *Node* <u>get_scene_collection</u>(*CoreTypes.SceneType* <u>type</u>)
:::danger
NEVER change a scene collection's properties or free it! You can CRASH the CORE Framework easily by doing this!
:::
:::danger
NEVER free a scene yourself! You can CRASH the CORE Framework easily by doing this!
:::
Returns a scene collection node. Useful if you want to change the node's position or want direct access to one.
## *Array[Node]* <u>get_scene_collection_list</u>(*CoreTypes.SceneType* <u>type</u>)
Returns a list of all loaded scenes in some scene collection.
## *int* <u>get_scene_collection_count</u>(*CoreTypes.SceneType* <u>type</u>)
Returns the number of loaded scenes in some scene collection.
## *CoresTypes.SceneType* <u>exists</u>(*String* <u>sname</u>)
Returns the scene collection a scene is loaded in.
Returns `CoreTypes.SceneType.NONE` if no scene with that name has been found.

View file

@ -1,11 +0,0 @@
---
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.

15
docs/docs/terminology.md Normal file
View file

@ -0,0 +1,15 @@
---
sidebar_position: 2
---
# 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.
## `EDL`
Stands for **Easy DownLoader** and allows you to download stuff.
## `SMS`
No, it does not stand for **Short Message Service**, but for **Scene Management System**. It manages your scenes.

View file

@ -115,7 +115,7 @@ const config: Config = {
],
markdown: {
format: "md",
format: "detect",
mermaid: false,
},