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
- theAsset
type
- Direct Known Subclasses:
ControlsConfigAssetLoader
,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 anAsset
to 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 anAssetHandle
for 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 anAssetHandle
to the asset.boolean
Checks to see if an asset mapping has already been added to this loader.protected abstract AssetHandle<T>
Returns anAssetHandle
for 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 anAsset
to this loader.- Parameters:
id
- the id for theAsset
asset
- theAsset
- Returns:
- this loader
-
get
Returns anAssetHandle
for 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 anAssetHandle
to the asset.- Parameters:
id
- id of the assetpath
- path to the asset- Returns:
- handle for the asset
-
getAssetClass
-
loadAsset
Returns anAssetHandle
for the specified path and beings loading theAsset
.- Parameters:
path
- the path to the asset- Returns:
- the
AssetHandle
for the path
-