alb

package
v0.0.0-...-91d505a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigValueTypeByte

func ConfigValueTypeByte(typ ConfigType) byte

ConfigValueTypeByte returns the type byte for a config type.

func DecodeConfigValue

func DecodeConfigValue(typ ConfigType, data []byte) (any, int)

DecodeConfigValue decodes a typed value from bytes.

func EncodeConfigValue

func EncodeConfigValue(typ ConfigType, value any) []byte

EncodeConfigValue encodes a typed value into bytes.

Types

type Bundle

type Bundle struct {
	Sections []BundleSection
}

func DecodeBundle

func DecodeBundle(data []byte) (*Bundle, error)

func (*Bundle) AddAttr

func (b *Bundle) AddAttr(name string, value []byte)

func (*Bundle) Encode

func (b *Bundle) Encode() []byte

func (*Bundle) GetAttr

func (b *Bundle) GetAttr(name string) []byte

type BundleSection

type BundleSection struct {
	Type  BundleType
	Flags uint16
	Name  string
	Data  []byte
}

type BundleType

type BundleType byte
const (
	BundleTypeAttr   BundleType = 0
	BundleTypeBinary BundleType = 1
	BundleTypeSprite BundleType = 2
	BundleTypeConfig BundleType = 3
)

func (BundleType) String

func (bt BundleType) String() string

type Config

type Config struct {
	Sections []ConfigSection `yaml:"sections"`
}

func DecodeConfig

func DecodeConfig(b *Bundle) (*Config, error)

DecodeConfig parses a bundle back into a Config struct.

func (Config) Encode

func (s Config) Encode() (*Bundle, error)

Encode validates the config and encodes it into a bundle.

func (Config) Validate

func (s Config) Validate() error

type ConfigItem

type ConfigItem struct {
	Key     string         `yaml:"key"`
	Title   string         `yaml:"title"`
	Hint    string         `yaml:"hint,omitempty"`
	Type    ConfigType     `yaml:"type"`
	Default any            `yaml:"default"`
	Min     any            `yaml:"min,omitempty"`
	Max     any            `yaml:"max,omitempty"`
	Step    any            `yaml:"step,omitempty"`
	Options []ConfigOption `yaml:"options,omitempty"`
}

type ConfigOption

type ConfigOption struct {
	Value any    `yaml:"value"`
	Label string `yaml:"label"`
}

type ConfigSection

type ConfigSection struct {
	Title string       `yaml:"title"`
	Hint  string       `yaml:"hint,omitempty"`
	Items []ConfigItem `yaml:"items"`
}

type ConfigType

type ConfigType string
const (
	ConfigTypeString ConfigType = "string"
	ConfigTypeBool   ConfigType = "bool"
	ConfigTypeInt    ConfigType = "int"
	ConfigTypeFloat  ConfigType = "float"
)

func ConfigTypeFromByte

func ConfigTypeFromByte(b byte) ConfigType

ConfigTypeFromByte returns the config type for a type byte.

type Sprite

type Sprite struct {
	Width, Height int
	Image, Mask   []byte
}

func DecodeSprite

func DecodeSprite(als []byte) *Sprite

func SpriteFromPNG

func SpriteFromPNG(data []byte, scale int) *Sprite

func (Sprite) Encode

func (s Sprite) Encode() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL