Module technology.sola.engine
Package technology.sola.engine.assets
Class AssetLoader<T extends Asset>
java.lang.Object
technology.sola.engine.assets.AssetLoader<T>
- Type Parameters:
T- theAssettype
- Direct Known Subclasses:
FontAssetLoader,GuiJsonDocumentAssetLoader,SpriteSheetAssetLoader
The AssetLoader class contains functionality for loading an
Asset type. These are implemented for each
SolaPlatform and Asset combination.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionManually add anAssetto this loader.addAssetMapping(String id, String path) Adds an asset id to path mapping but does not populate the cache until the asset is requested viaget(String)Returns anAssetHandlefor the asset requested or throws an exception if id to path mapping not found.getNewAsset(String id, String path) Adds an asset id to path mapping and then returns anAssetHandleto the asset.booleanChecks to see if an asset mapping has already been added to this loader.protected abstract AssetHandle<T>Returns anAssetHandlefor the specified path and beings loading theAsset.
-
Constructor Details
-
AssetLoader
public AssetLoader()
-
-
Method Details
-
addAssetMapping
Adds an asset id to path mapping but does not populate the cache until the asset is requested viaget(String)- Parameters:
id- id of the assetpath- path to the asset- Returns:
- this
-
hasAssetMapping
Checks to see if an asset mapping has already been added to this loader.- Parameters:
id- the id for the asset mapping- Returns:
- true if the asset mapping has already been added
-
addAsset
Manually add anAssetto this loader.- Parameters:
id- the id for theAssetasset- theAsset- Returns:
- this loader
-
get
Returns anAssetHandlefor the asset requested or throws an exception if id to path mapping not found.- Parameters:
id- id of the asset- Returns:
- handle for the asset
-
getNewAsset
Adds an asset id to path mapping and then returns anAssetHandleto the asset.- Parameters:
id- id of the assetpath- path to the asset- Returns:
- handle for the asset
-
getAssetClass
-
loadAsset
Returns anAssetHandlefor the specified path and beings loading theAsset.- Parameters:
path- the path to the asset- Returns:
- the
AssetHandlefor the path
-