Documentation ¶
Index ¶
- type AssetData
- type AssetResource
- type AssetType
- type AudioClipAsset
- type AudioLoader
- func (al *AudioLoader) EachAudioClip(fn func(name string, asset AssetResource[AudioClipAsset]))
- func (al *AudioLoader) EachAudioStream(fn func(name string, asset AssetResource[AudioStreamAsset]))
- func (al *AudioLoader) GetAudioClip(name string) (AssetResource[AudioClipAsset], bool)
- func (al *AudioLoader) GetAudioClips() map[string]AssetResource[AudioClipAsset]
- func (al *AudioLoader) GetAudioStream(name string) (AssetResource[AudioStreamAsset], bool)
- func (al *AudioLoader) GetAudioStreams() map[string]AssetResource[AudioStreamAsset]
- func (al *AudioLoader) LoadAudioClip(name, path string) (AssetResource[AudioClipAsset], error)
- func (al *AudioLoader) LoadAudioStream(name, path string) (AssetResource[AudioStreamAsset], error)
- func (al *AudioLoader) RemoveAudioClip(name string)
- func (al *AudioLoader) RemoveAudioStream(name string)
- type AudioStreamAsset
- type ErrAssetAlreadyExists
- type ErrInvalidFileFormat
- type ErrUnsupportedAssetType
- type FontAsset
- type FontLoader
- func (fl *FontLoader) EachFont(fn func(name string, asset AssetResource[FontAsset]))
- func (fl *FontLoader) GetFont(name string) (AssetResource[FontAsset], bool)
- func (fl *FontLoader) GetFonts() map[string]AssetResource[FontAsset]
- func (fl *FontLoader) LoadFont(name, path string, options *truetype.Options, runeSets ...[]rune) (AssetResource[FontAsset], error)
- func (fl *FontLoader) RemoveFont(name string)
- type Loader
- type TextureAsset
- type TextureLoader
- func (tl *TextureLoader) EachTexture(fn func(name string, asset AssetResource[TextureAsset]))
- func (tl *TextureLoader) GetTexture(name string) (AssetResource[TextureAsset], bool)
- func (tl *TextureLoader) GetTextures() map[string]AssetResource[TextureAsset]
- func (tl *TextureLoader) LoadTexture(name string, path string) (AssetResource[TextureAsset], error)
- func (tl *TextureLoader) RemoveTexture(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetData ¶
type AssetData interface { FontAsset | AudioClipAsset | AudioStreamAsset | TextureAsset }
type AssetResource ¶
AssetResource is a type that defines an asset resource. An asset resource is a resource that is loaded by the asset loader. It holds the data of the asset.
type AssetType ¶
type AssetType string
AssetType is a type that defines the type of an asset.
const ( PngImageAssetType AssetType = "image/png" JpegImageAssetType AssetType = "image/jpeg" Mp3AudioAssetType AssetType = "audio/mp3" WavAudioAssetType AssetType = "audio/wav" Mp3AudioStreamAssetType AssetType = "audio/mp3-stream" WavAudioStreamAssetType AssetType = "audio/wav-stream" TFFAssetType AssetType = "font/ttf" )
func GetAssetTypeByPath ¶ added in v0.3.3
GetAssetTypeByPath gets the asset type by the path.
type AudioClipAsset ¶ added in v0.3.3
AudioClipAsset is a type that defines a audio clip asset. It holds the buffer and format. A audio clip asset is a audio asset that is loaded into memory.
type AudioLoader ¶
type AudioLoader struct {
// contains filtered or unexported fields
}
func NewAudioLoader ¶
func NewAudioLoader() AudioLoader
func (*AudioLoader) EachAudioClip ¶
func (al *AudioLoader) EachAudioClip(fn func(name string, asset AssetResource[AudioClipAsset]))
EachAudioClip iterates over all audio clip assets in the asset loader.
func (*AudioLoader) EachAudioStream ¶
func (al *AudioLoader) EachAudioStream(fn func(name string, asset AssetResource[AudioStreamAsset]))
EachAudioStream iterates over all audio stream assets in the asset loader.
func (*AudioLoader) GetAudioClip ¶
func (al *AudioLoader) GetAudioClip(name string) (AssetResource[AudioClipAsset], bool)
GetAudioClip gets a audio clip asset from the asset loader.
func (*AudioLoader) GetAudioClips ¶
func (al *AudioLoader) GetAudioClips() map[string]AssetResource[AudioClipAsset]
GetAudioClips gets all audio clip assets from the asset loader.
func (*AudioLoader) GetAudioStream ¶
func (al *AudioLoader) GetAudioStream(name string) (AssetResource[AudioStreamAsset], bool)
GetAudioStream gets a audio stream asset from the asset loader.
func (*AudioLoader) GetAudioStreams ¶
func (al *AudioLoader) GetAudioStreams() map[string]AssetResource[AudioStreamAsset]
GetAudioStreams gets all audio stream assets from the asset loader.
func (*AudioLoader) LoadAudioClip ¶
func (al *AudioLoader) LoadAudioClip(name, path string) (AssetResource[AudioClipAsset], error)
LoadAudioClip loads a audio clip asset into the asset loader.
func (*AudioLoader) LoadAudioStream ¶
func (al *AudioLoader) LoadAudioStream(name, path string) (AssetResource[AudioStreamAsset], error)
LoadAudioStream loads a audio stream asset into the asset loader.
func (*AudioLoader) RemoveAudioClip ¶
func (al *AudioLoader) RemoveAudioClip(name string)
RemoveAudioClip removes a audio clip asset from the asset loader.
func (*AudioLoader) RemoveAudioStream ¶
func (al *AudioLoader) RemoveAudioStream(name string)
RemoveAudioStream removes a audio stream asset from the asset loader.
type AudioStreamAsset ¶
type AudioStreamAsset struct { Stream beep.StreamSeekCloser Format beep.Format }
AudioStreamAsset is a type that defines a audio stream asset. It holds the stream and format. A audio stream asset is a audio asset that is streamed from the disk.
type ErrAssetAlreadyExists ¶
type ErrAssetAlreadyExists struct {
// contains filtered or unexported fields
}
ErrAssetAlreadyExists is an error that is returned when the asset already exists.
func (ErrAssetAlreadyExists) Error ¶
func (e ErrAssetAlreadyExists) Error() string
type ErrInvalidFileFormat ¶
type ErrInvalidFileFormat struct {
// contains filtered or unexported fields
}
ErrInvalidFileFormat is an error that is returned when the file format is invalid.
func (ErrInvalidFileFormat) Error ¶
func (e ErrInvalidFileFormat) Error() string
type ErrUnsupportedAssetType ¶ added in v0.3.3
type ErrUnsupportedAssetType struct {
// contains filtered or unexported fields
}
ErrUnsupportedAssetType is an error that is returned when the asset type is unsupported.
func (ErrUnsupportedAssetType) Error ¶ added in v0.3.3
func (e ErrUnsupportedAssetType) Error() string
type FontLoader ¶
type FontLoader struct {
// contains filtered or unexported fields
}
func NewFontLoader ¶
func NewFontLoader() FontLoader
func (*FontLoader) EachFont ¶
func (fl *FontLoader) EachFont(fn func(name string, asset AssetResource[FontAsset]))
EachFont iterates over all font assets in the asset loader.
func (*FontLoader) GetFont ¶
func (fl *FontLoader) GetFont(name string) (AssetResource[FontAsset], bool)
GetFont gets a font asset from the asset loader.
func (*FontLoader) GetFonts ¶
func (fl *FontLoader) GetFonts() map[string]AssetResource[FontAsset]
GetFonts gets all font assets from the asset loader.
func (*FontLoader) LoadFont ¶
func (fl *FontLoader) LoadFont(name, path string, options *truetype.Options, runeSets ...[]rune) (AssetResource[FontAsset], error)
LoadFont loads a font asset into the asset loader.
func (*FontLoader) RemoveFont ¶
func (fl *FontLoader) RemoveFont(name string)
RemoveFont removes a font asset from the asset loader.
type Loader ¶
type Loader struct { FontLoader TextureLoader AudioLoader }
type TextureAsset ¶
TextureAsset is a type that defines a texture asset. It holds the picture.
type TextureLoader ¶
type TextureLoader struct {
// contains filtered or unexported fields
}
func NewTextureLoader ¶
func NewTextureLoader() TextureLoader
func (*TextureLoader) EachTexture ¶
func (tl *TextureLoader) EachTexture(fn func(name string, asset AssetResource[TextureAsset]))
EachTexture iterates over all texture assets in the asset loader.
func (*TextureLoader) GetTexture ¶
func (tl *TextureLoader) GetTexture(name string) (AssetResource[TextureAsset], bool)
GetTexture gets a texture asset from the asset loader.
func (*TextureLoader) GetTextures ¶
func (tl *TextureLoader) GetTextures() map[string]AssetResource[TextureAsset]
GetTextures gets all texture assets from the asset loader.
func (*TextureLoader) LoadTexture ¶
func (tl *TextureLoader) LoadTexture(name string, path string) (AssetResource[TextureAsset], error)
LoadTexture loads a texture asset into the asset loader.
func (*TextureLoader) RemoveTexture ¶
func (tl *TextureLoader) RemoveTexture(name string)
RemoveTexture removes a texture asset from the asset loader.