Documentation ¶
Index ¶
- Variables
- func SetEmbedAssetRoot(root fs.FS)
- type Asset
- type Assets
- func (assets *Assets) Add(ref Ref) *Asset
- func (assets *Assets) AddDefaults()
- func (assets *Assets) AddFormat(format Format)
- func (assets *Assets) AddMany(refs []Ref) []*Asset
- func (assets *Assets) AddManyMap(refs []Ref) map[string]*Asset
- func (assets *Assets) AddSource(source Source)
- func (assets *Assets) Destroy()
- func (assets *Assets) Get(uri string) *Asset
- func (assets *Assets) GetEither(nameOrURI string) *Asset
- func (assets *Assets) GetNamed(name string) *Asset
- func (assets *Assets) GetRef(ref Ref) *Asset
- type EmbedAssetSource
- type FileSystemAssetSource
- type Format
- type JsonArray
- type JsonGenericAssetFormat
- func (format *JsonGenericAssetFormat) Activate(asset *Asset) error
- func (format *JsonGenericAssetFormat) Deactivate(asset *Asset) error
- func (format *JsonGenericAssetFormat) Handles(ref Ref) bool
- func (format *JsonGenericAssetFormat) Load(asset *Asset) error
- func (format *JsonGenericAssetFormat) Types() []Type
- func (format *JsonGenericAssetFormat) Unload(asset *Asset) error
- type JsonObject
- type JsonValue
- type JsonValueKind
- type LocalAssetSource
- type Ref
- type Source
- type Status
- type Type
- type WebAssetSource
- type XmlAssetFormat
- func (format *XmlAssetFormat[T]) Activate(asset *Asset) error
- func (format *XmlAssetFormat[T]) Deactivate(asset *Asset) error
- func (format *XmlAssetFormat[T]) Handles(ref Ref) bool
- func (format *XmlAssetFormat[T]) Load(asset *Asset) error
- func (format *XmlAssetFormat[T]) Types() []Type
- func (format *XmlAssetFormat[T]) Unload(asset *Asset) error
- type XmlGenericAssetFormat
- func (format *XmlGenericAssetFormat) Activate(asset *Asset) error
- func (format *XmlGenericAssetFormat) Deactivate(asset *Asset) error
- func (format *XmlGenericAssetFormat) Handles(ref Ref) bool
- func (format *XmlGenericAssetFormat) Load(asset *Asset) error
- func (format *XmlGenericAssetFormat) Types() []Type
- func (format *XmlGenericAssetFormat) Unload(asset *Asset) error
- type XmlNode
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoEmbeddedFileSystem = errors.New("no embedded files set via axe.SetEmbedAssetRoot")
Functions ¶
func SetEmbedAssetRoot ¶
Types ¶
type Asset ¶
type Asset struct { Ref Ref Source Source SourceReader io.Reader Format Format LoadStatus Status Data any ActivateStatus Status Dependent []Ref Next []Ref }
func (*Asset) LoadReader ¶
type Assets ¶
type Assets struct { FormatMap map[Type]Format Formats []Format Sources []Source DefaultSource Source Assets map[string]*Asset NamedAssets map[string]*Asset }
func (*Assets) AddDefaults ¶
func (assets *Assets) AddDefaults()
type EmbedAssetSource ¶
type EmbedAssetSource struct{}
func (EmbedAssetSource) Handles ¶
func (local EmbedAssetSource) Handles(ref Ref) bool
type FileSystemAssetSource ¶
type FileSystemAssetSource struct { Files fs.FS HandlesPattern *regexp.Regexp CustomRelative func(uri string, relative string) string }
func (FileSystemAssetSource) Handles ¶
func (src FileSystemAssetSource) Handles(ref Ref) bool
type Format ¶
type Format interface { // Does this format handle refs like this one. Handles(ref Ref) bool // Native types this format handles. Types() []Type // Load the asset from the source. This could be done in any thread. Load(asset *Asset) error // Unload the asset, we don't need it anymore. This could be done in any thread. Unload(asset *Asset) error // The asset is loaded by we need to use it now. This is done in the main thread. Activate(asset *Asset) error // The asset is not needed right now, but don't unload it yet. This is done in the main thread. Deactivate(asset *Asset) error }
type JsonGenericAssetFormat ¶
type JsonGenericAssetFormat struct{}
func (*JsonGenericAssetFormat) Activate ¶
func (format *JsonGenericAssetFormat) Activate(asset *Asset) error
func (*JsonGenericAssetFormat) Deactivate ¶
func (format *JsonGenericAssetFormat) Deactivate(asset *Asset) error
func (*JsonGenericAssetFormat) Handles ¶
func (format *JsonGenericAssetFormat) Handles(ref Ref) bool
func (*JsonGenericAssetFormat) Load ¶
func (format *JsonGenericAssetFormat) Load(asset *Asset) error
func (*JsonGenericAssetFormat) Types ¶
func (format *JsonGenericAssetFormat) Types() []Type
func (*JsonGenericAssetFormat) Unload ¶
func (format *JsonGenericAssetFormat) Unload(asset *Asset) error
type JsonObject ¶
type JsonValue ¶
type JsonValue struct { Kind JsonValueKind Value any Parent *JsonValue }
type JsonValueKind ¶
type JsonValueKind int
const ( JsonValueKindUnknown JsonValueKind = iota JsonValueKindNull JsonValueKindNumber JsonValueKindString JsonValueKindBoolean JsonValueKindObject JsonValueKindArray )
type LocalAssetSource ¶
type LocalAssetSource struct{}
func (LocalAssetSource) Handles ¶
func (local LocalAssetSource) Handles(ref Ref) bool
type Ref ¶
func (Ref) UniqueName ¶
type Type ¶
type Type string
const ( TypeUnknown Type = "" TypeTexture Type = "texture" TypeAudio Type = "audio" TypeVertexShader Type = "vertex-shader" TypeFragmentShader Type = "fragment-shader" TypeXml Type = "xml" TypeJson Type = "json" TypeModel Type = "model" TypeMaterials Type = "materials" TypeMaterial Type = "material" TypeFontBitmap Type = "font-bitmap" )
type WebAssetSource ¶
type WebAssetSource struct{}
func (WebAssetSource) Handles ¶
func (local WebAssetSource) Handles(ref Ref) bool
type XmlAssetFormat ¶
type XmlAssetFormat[T any] struct { EmptyValue T Suffix string SuffixInsensitive bool Regex *regexp.Regexp CustomTypes []Type }
func (*XmlAssetFormat[T]) Activate ¶
func (format *XmlAssetFormat[T]) Activate(asset *Asset) error
func (*XmlAssetFormat[T]) Deactivate ¶
func (format *XmlAssetFormat[T]) Deactivate(asset *Asset) error
func (*XmlAssetFormat[T]) Handles ¶
func (format *XmlAssetFormat[T]) Handles(ref Ref) bool
func (*XmlAssetFormat[T]) Load ¶
func (format *XmlAssetFormat[T]) Load(asset *Asset) error
func (*XmlAssetFormat[T]) Types ¶
func (format *XmlAssetFormat[T]) Types() []Type
func (*XmlAssetFormat[T]) Unload ¶
func (format *XmlAssetFormat[T]) Unload(asset *Asset) error
type XmlGenericAssetFormat ¶
type XmlGenericAssetFormat struct{}
func (*XmlGenericAssetFormat) Activate ¶
func (format *XmlGenericAssetFormat) Activate(asset *Asset) error
func (*XmlGenericAssetFormat) Deactivate ¶
func (format *XmlGenericAssetFormat) Deactivate(asset *Asset) error
func (*XmlGenericAssetFormat) Handles ¶
func (format *XmlGenericAssetFormat) Handles(ref Ref) bool
func (*XmlGenericAssetFormat) Load ¶
func (format *XmlGenericAssetFormat) Load(asset *Asset) error
func (*XmlGenericAssetFormat) Types ¶
func (format *XmlGenericAssetFormat) Types() []Type
func (*XmlGenericAssetFormat) Unload ¶
func (format *XmlGenericAssetFormat) Unload(asset *Asset) error
Click to show internal directories.
Click to hide internal directories.