Started documentation

This commit is contained in:
Otto 2024-10-09 10:32:56 +03:00
parent fe0863aea6
commit 49f5bd326f
4 changed files with 83 additions and 0 deletions

View file

72
docs/classes/manager.md Normal file
View file

@ -0,0 +1,72 @@
# Manager
`inherits SubViewport`
### Usage
This is the backbone of the demo.
The `Manager` is responsible for the scene management and background music.
#### Setup
1. Create a new scene with a type of `Manager` and make it the main scene.
2. Set the `Bgm` from either in-editor or through code.
3. Add scenes to be run in order with `register_scene()`
4. Create a child of type `AnimationPlayer` and create a new animation with a `Call Method Track`
5. Add keyframes at points where you wish the scene to be changed. Call method `set_scene(scene_number)`.
6. Call `start_audio()` and `$AnimationPlayer.play()` to start the bgm and scene timeline
#### Example script
```gdscript
extends Manager
var scene1: PackedScene = preload("res://entities/scene_1.tscn");
var scene2: PackedScene = preload("res://entities/scene_2.tscn");
var scene3: PackedScene = preload("res://entities/scene_3.tscn");
var scene4: PackedScene = preload("res://entities/scene_4.tscn");
func _ready() -> void:
register_scene(scene1);
register_scene(scene2);
register_scene(scene3);
register_scene(scene4);
start_audio();
$AnimationPlayer.play("timeline");
```
### Properties
| Type | Name | Default |
| -------------------- | ----------- | ------- |
| `String` | bgm | `Null` |
| `Array[PackedScene]` | scenes | `Array[PackedScene]` |
| `int` | beat_count (unused) | `Null` |
`bgm`
Stores the path to the background music as `String`
`scenes` stores the registered scenes. Usually you shouldn't edit this manually
`beat_count` Unused
### Methods
| Returns | Name |
| ------- | ---- |
| `void` | `set_scene(number: int)` |
| `void` | `register_scene(scene: PackedScene)` |
| `void` | `start_audio()` |
#### set_scene(number: int)
Changes the current scene to the scene at index `number` in `scenes`
#### register_scene(scene: PackedScene)
Registers the `scene` to the manager.
Each registered scene is added to `scenes` and gets preloaded into memory.
The scene number is the scene's index in `scenes`, so the first scene registered gets number `0`, the next one gets number `1` and so on.
#### start_audio()
Calling this function will start playing back the `bgm` on the main bus.

View file

11
docs/docs.md Normal file
View file

@ -0,0 +1,11 @@
# MiniDemoTools documentation
MiniDemoTools is a collection of tools for Godot used internally for demo development at Minihakkerit.
MiniDemoTools supports Godot versions >4.1
## Custom classes
- [Manager](classes/manager.md)
- [ScramblingText](classes/scramblingtext.md)
- [DynamicSubViewport](classes/dynamicsubviewport.md)