Documentation
¶
Index ¶
- func ConfigValueTypeByte(typ ConfigType) byte
- func DecodeConfigValue(typ ConfigType, data []byte) (any, int)
- func EncodeConfigValue(typ ConfigType, value any) []byte
- type Bundle
- type BundleSection
- type BundleType
- type Config
- type ConfigItem
- type ConfigOption
- type ConfigSection
- type ConfigType
- type Sprite
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 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 ¶
DecodeConfig parses a bundle back into a Config struct.
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 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.
Click to show internal directories.
Click to hide internal directories.