config library

This commit is contained in:
Jill 2023-05-04 21:40:42 +03:00
parent 59ca5e743d
commit 89e3b71ab5
Signed by: oat
GPG Key ID: 33489AA58A955108
3 changed files with 27 additions and 7 deletions

View File

@ -41,6 +41,10 @@ Uranium Template originally formed during the creation of a currently unreleased
- [`focus(hasFocus: boolean)`](#focushasfocus-boolean)
- [Custom callbacks](#custom-callbacks)
- [Requiring files](#requiring-files)
- [Configuration](#configuration)
- [`uranium.config.resetOnFrameStart(bool: boolean)`](#uraniumconfigresetonframestartbool-boolean)
- [`uranium.config.resetActorOnFrameStart(actor: Actor, bool: boolean?)`](#uraniumconfigresetactoronframestartactor-actor-bool-boolean)
- [`uranium.config.hideThemeActors(bool: boolean)`](#uraniumconfighidethemeactorsbool-boolean)
- [Standard library](#standard-library)
- [Importing modules](#importing-modules)
- [`vector2D`](#vector2d)
@ -200,10 +204,10 @@ text:rotationz(30)
text:diffuse(1, 0.8, 0.8, 1)
```
All methods that you run upon definition will be ran again at the start of every frame with `resetOnFrameStart`:
All methods that you run upon definition will be ran again at the start of every frame with `uranium.config.resetOnFrameStart`:
```lua
resetOnFrameStart(true)
uranium.config.resetOnFrameStart(true)
local quad = Quad()
quad:xy(scx, scy)
@ -239,9 +243,9 @@ end)
Or, you can disable the frame resetting functionality individually:
```lua
resetOnFrameStart(true)
uranium.config.resetOnFrameStart(true)
local sprite = Sprite()
resetActorOnFrameStart(sprite, false)
uranium.config.resetActorOnFrameStart(sprite, false)
sprite:Draw() -- will not be called per-frame
```
@ -483,6 +487,22 @@ Your setup would print `'hello!'`.
All [standard library](#standard-library) modules are required with `require`, see further notes in [**Importing modules**](#importing-modules).
## Configuration
Uranium Template's base functionality can be configured using `uranium.config`. You can access the raw values by requiring `uranium.config`, but this is currently undocumented.
#### `uranium.config.resetOnFrameStart(bool: boolean)`
Toggle actor resetting on frame start behavior by default. _(Default: `false`)_
#### `uranium.config.resetActorOnFrameStart(actor: Actor, bool: boolean?)`
Toggle actor resetting on frame start for individual actors. `bool` defaults to the opposite of your `resetOnFrameStart` config.
#### `uranium.config.hideThemeActors(bool: boolean)`
Toggle if theme actors (lifebars, scores, song names, etc.) are hidden. Must be toggled **before** `init`. _(Default: `true`)_
## Standard library
The Uranium Template standard library is split up into a few convinient modules. This section aims to comprehensively document them all.
@ -1144,7 +1164,7 @@ quad:xy(scx, scy)
quad:zoom(120)
quad:diffuse(0.8, 1, 0.7, 1)
quad:skewx(0.2)
resetActorOnFrameStart(quad)
uranium.config.resetActorOnFrameStart(quad)
-- define a sprite
local sprite = Sprite('docs/uranium.png')

View File

@ -10,7 +10,7 @@ quad:xy(scx, scy)
quad:zoom(120)
quad:diffuse(0.8, 1, 0.7, 1)
quad:skewx(0.2)
resetActorOnFrameStart(quad)
uranium.config.resetActorOnFrameStart(quad)
-- define a sprite
local sprite = Sprite('docs/uranium.png')

@ -1 +1 @@
Subproject commit dd7234cc9ed77d8837dee83ad4462eb192a3cf20
Subproject commit b34c18da8a0aa811ba2a8abd5ec858930518cbe2