generated
This package contains all of the auto-generated data at build-time. Currently it stores:
- Sprite data: Assigns atlas UV and image size in pixels to every PNG image from assets/images.
Manages animation and tileset data. More information on that topic can be found in the
bonsai:core/renderpackage overview. - Font data: Grabs TTF files present in the
assets/fontsdirectory, generates bitmap using thestblibrary. Makes the fonts easily accessible with theFontNameenum. - Audio data: Grabs WAV files present in the
assets/audiodirectory and links each sound to aAudioNameenum. - Scene data: Generates a registry in the
source/game/scenesdirectory, which registers all created scenes. Using directory names, generates aSceneNameenum to access them. Example usage can be found in thebonsai:core/scenepackage overview.
AudioName
Section titled “AudioName”AudioName :: enum { nil,}Contains all filename stems for Audios.
FontName
Section titled “FontName”FontName :: enum { nil, PixelCode,}Contains all filename stems for Fonts.
SceneName
Section titled “SceneName”SceneName :: enum { nil,}Contains all filename stems for Scenes.
SpriteData
Section titled “SpriteData”SpriteData :: struct { uv: gmath.Vector4, size: gmath.Vector2,}Struct assigned to every sprite present on the atlas.
SpriteName
Section titled “SpriteName”SpriteName :: enum { nil,}Enum containing all sprite file names.
audioFilename
Section titled “audioFilename”audioFilename: = [AudioName]string { .nil = "",}Links every AudioName enum to their path relative to the project root.
fontFilename
Section titled “fontFilename”fontFilename: = [FontName]string { .nil = "", .PixelCode = "bonsai/core/ui/PixelCode.ttf",}Links every FontName enum to their path relative to the project root.
getFrameCount
Section titled “getFrameCount”getFrameCount :: proc (sprite: SpriteName) -> intReturns amount of frames a SpriteName contains.
Returns 1 if the sprite isn’t animated.
getSpriteData
Section titled “getSpriteData”getSpriteData :: proc (sprite: SpriteName) -> SpriteDataFunction used internally to get SpriteData from a SpriteName enum.