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 here.
- 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 aSoundNameenum. - 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 here.
AudioName
Section titled “AudioName”AudioName :: enum { nil,}Contains all filename stems for Audios.
FontName
Section titled “FontName”FontName :: enum { nil, PixelCode, Roboto,}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, frames: int,}Struct assigned to every sprite present on the atlas.
SpriteName
Section titled “SpriteName”SpriteName :: enum u32 { nil, testAsset, testAsset2,}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_12.ttf", .Roboto = "assets/fonts/Roboto.ttf",}Links every FontName enum to their path relative to the project root.
getFontNativeSize
Section titled “getFontNativeSize”getFontNativeSize :: proc (font: FontName) -> uintReturns the native size of the font parsed from its filename. Returns 0 if no size is specified.