Skip to content

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/fonts directory, generates bitmap using the stb library. Makes the fonts easily accessible with the FontName enum.
  • Audio data: Grabs WAV files present in the assets/audio directory and links each sound to a SoundName enum.
  • Scene data: Generates a registry in the source/game/scenes directory, which registers all created scenes. Using directory names, generates a SceneName enum to access them. Example usage can be found here.

AudioName :: enum {
nil,
}

Contains all filename stems for Audios.


FontName :: enum {
nil,
PixelCode,
Roboto,
}

Contains all filename stems for Fonts.


SceneName :: enum {
nil,
}

Contains all filename stems for Scenes.


SpriteData :: struct {
uv: gmath.Vector4,
size: gmath.Vector2,
frames: int,
}

Struct assigned to every sprite present on the atlas.


SpriteName :: enum u32 {
nil,
testAsset,
testAsset2,
}

Enum containing all sprite file names.


audioFilename: = [AudioName]string {
.nil = "",
}

Links every AudioName enum to their path relative to the project root.


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 :: proc (font: FontName) -> uint

Returns the native size of the font parsed from its filename. Returns 0 if no size is specified.