Documentation ¶
Index ¶
- type AssetManager
- func (assetManager *AssetManager) ClearAnimations(request *AssetRequest, overwrite bool)
- func (assetManager *AssetManager) ClearFonts()
- func (assetManager *AssetManager) ClearMusic()
- func (assetManager *AssetManager) ClearSoundEffects()
- func (assetManager *AssetManager) ClearTextures() error
- func (assetManager *AssetManager) LoadAnimation(request *AssetRequest, overwrite bool) error
- func (assetManager *AssetManager) LoadFont(request *AssetRequest, overwrite bool) error
- func (assetManager *AssetManager) LoadMusic(request *AssetRequest, overwrite bool) error
- func (assetManager *AssetManager) LoadSoundEffect(request *AssetRequest, overwrite bool) error
- func (assetManager *AssetManager) LoadTexture(renderer *sdl.Renderer, request *AssetRequest, overwrite bool) error
- type AssetRequest
- type AssetType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetManager ¶
type AssetManager struct { Textures map[string]*sdl.Texture Fonts map[string]*ttf.Font Music map[string]*mix.Music SoundEffects map[string]*mix.Chunk AnimationData map[string]*animation.Animation }
func NewAssetManager ¶
func NewAssetManager() *AssetManager
Creates and initializes a new AssetManager.
func (*AssetManager) ClearAnimations ¶
func (assetManager *AssetManager) ClearAnimations(request *AssetRequest, overwrite bool)
Clears all animations from the asset manager. If it already exists, then no action will be taken unless the overwite parameter is 'true'.
func (*AssetManager) ClearFonts ¶
func (assetManager *AssetManager) ClearFonts()
Clears all fonts and frees their memory.
func (*AssetManager) ClearMusic ¶
func (assetManager *AssetManager) ClearMusic()
Clears all music assets and frees their memory
func (*AssetManager) ClearSoundEffects ¶
func (assetManager *AssetManager) ClearSoundEffects()
Clears all sound effect assets and frees their memory.
func (*AssetManager) ClearTextures ¶
func (assetManager *AssetManager) ClearTextures() error
Clears all textures and frees their memory. Errors only arise when destroying pointers to nil or invalid textures.
func (*AssetManager) LoadAnimation ¶
func (assetManager *AssetManager) LoadAnimation(request *AssetRequest, overwrite bool) error
Loads animation data into the asset manager. If it already exists, then no action will be taken unless the overwite parameter is 'true'. Expects an animation data file which is in the 'bro' format.
func (*AssetManager) LoadFont ¶
func (assetManager *AssetManager) LoadFont(request *AssetRequest, overwrite bool) error
Loads a font into the asset manager. If it already exists, then no action will be taken unless the overwite parameter is 'true'.
func (*AssetManager) LoadMusic ¶
func (assetManager *AssetManager) LoadMusic(request *AssetRequest, overwrite bool) error
Loads music into the asset manager. If it already exists, then no action will be taken unless the overwite parameter is 'true'.
func (*AssetManager) LoadSoundEffect ¶
func (assetManager *AssetManager) LoadSoundEffect(request *AssetRequest, overwrite bool) error
Loads a sound effect into the asset manager. If it already exists, then no action will be taken unless the overwite parameter is 'true'.
func (*AssetManager) LoadTexture ¶
func (assetManager *AssetManager) LoadTexture(renderer *sdl.Renderer, request *AssetRequest, overwrite bool) error
Loads a texture into the asset manager. If it already exists, then no action will be taken unless the overite parameter is set to 'true'.
type AssetRequest ¶
type AssetRequest struct { Id string Value string FontId string FontSize int Color sdl.Color Type AssetType IsAnimationLooping bool }
A request for an asset of the specified type
func NewFontRequest ¶
func NewFontRequest(id, value string, fontSize int) *AssetRequest
Generates an asset request for a sdl font.
func NewFontTextureRequest ¶
func NewFontTextureRequest(id, value, fontId string, colorR, colorG, colorB, colorA uint8) *AssetRequest
Generates an asset request for a sdl texture.
func NewMusicRequest ¶
func NewMusicRequest(id, value string) *AssetRequest
func NewTextureRequest ¶
func NewTextureRequest(id, value string) *AssetRequest
Generates an asset request for a sdl texture.