Fork me on GitHub
View source

package haxepunk.assets

class AssetCache

An AssetCache can be used to cache and dispose of assets to control memory use. Use AssetCache.global to cache assets permanently.

Static variables

View source

static active : Array<AssetCache>

Constructor

View source

new (name : String) : Void

Variables

read only enabled : Bool

name : String

Functions

View source

addAtlasData (id : String, data : AtlasData) : Void

View source

addAtlasRegion (id : String, region : IAtlasRegion) : Void

View source

addBitmapFont (fontName : String, font : IBitmapFont) : Void

View source

addBitmapFontSizes (fontName : String, fonts : Array<String>, format : BitmapFontFormat = BitmapFontFormat.XML, extraParams : Dynamic) : BitmapFont

Add multiple BitmapFontAtlases to a single BitmapFont, representing multiple sizes of a single font. You can then reference this font as fontName in place of a bitmap font asset. BitmapText will automatically use the most appropriate size of the font when rendering.

View source

addResolutions (id : String, assets : Array<String>) : AtlasResolutions

Register multiple assets as different resolutions of a single image.

After calling this method, use id wherever image assets are expected: new Image(id). Graphics will pick the appropriate resolution from the list when rendering this asset.

View source

addSound (id : String, sound : Dynamic) : Void

View source

addText (id : String, value : String) : Void

View source

addTexture (id : String, texture : Texture) : Void

View source

addTextureAtlas (atlas : TextureAtlas) : Void

Add all of the regions from a TextureAtlas to the AssetCache.

After calling this method, regions can be specified wherever images assets are expected, e.g. new Image("my_atlas_region").

View source

addTileAtlas (id : String, atlas : TileAtlas) : Void

View source

dispose () : Void

View source

enable () : Void

View source

getAtlasData (id : String, addRef : Bool = true) : AtlasData

View source

getAtlasRegion (id : String, addRef : Bool = true) : IAtlasRegion

View source

getBitmapFont (fontName : String, addRef : Bool = true) : IBitmapFont

View source

getSound (id : String, addRef : Bool = true) : Dynamic

View source

getText (id : String, addRef : Bool = true) : String

View source

getTexture (id : String, addRef : Bool = true) : Texture

View source

getTileAtlas (id : String, addRef : Bool = true) : TileAtlas

View source

removeAtlasData (id : String) : Void

View source

removeAtlasRegion (id : String) : Void

View source

removeBitmapFont (fontName : String) : Void

View source

removeSound (id : String) : Void

View source

removeText (id : String) : Void

View source

removeTexture (id : String) : Void

View source

removeTileAtlas (id : String) : Void