Package com.badlogic.gdx.assets.loaders
Class SkinLoader
- java.lang.Object
-
- com.badlogic.gdx.assets.loaders.AssetLoader<T,P>
-
- com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<Skin,SkinLoader.SkinParameter>
-
- com.badlogic.gdx.assets.loaders.SkinLoader
-
public class SkinLoader extends AsynchronousAssetLoader<Skin,SkinLoader.SkinParameter>
AssetLoader
forSkin
instances. AllTexture
andBitmapFont
instances will be loaded as dependencies. Passing aSkinLoader.SkinParameter
allows the exact name of the texture associated with the skin to be specified. Otherwise the skin texture is looked up just as with a call toSkin(com.badlogic.gdx.files.FileHandle)
. ASkinLoader.SkinParameter
also allows named resources to be set that will be added to the skin before loading the json file, meaning that they can be referenced from inside the json file itself. This is useful for dynamic resources such as a BitmapFont generated through FreeTypeFontGenerator.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SkinLoader.SkinParameter
-
Constructor Summary
Constructors Constructor Description SkinLoader(FileHandleResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Array<AssetDescriptor>
getDependencies(java.lang.String fileName, FileHandle file, SkinLoader.SkinParameter parameter)
Returns the assets this asset requires to be loaded first.void
loadAsync(AssetManager manager, java.lang.String fileName, FileHandle file, SkinLoader.SkinParameter parameter)
Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.Skin
loadSync(AssetManager manager, java.lang.String fileName, FileHandle file, SkinLoader.SkinParameter parameter)
Loads the OpenGL part of the asset.protected Skin
newSkin(TextureAtlas atlas)
Override to allow subclasses of Skin to be loaded or the skin instance to be configured.-
Methods inherited from class com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader
unloadAsync
-
Methods inherited from class com.badlogic.gdx.assets.loaders.AssetLoader
resolve
-
-
-
-
Constructor Detail
-
SkinLoader
public SkinLoader(FileHandleResolver resolver)
-
-
Method Detail
-
getDependencies
public Array<AssetDescriptor> getDependencies(java.lang.String fileName, FileHandle file, SkinLoader.SkinParameter parameter)
Description copied from class:AssetLoader
Returns the assets this asset requires to be loaded first. This method may be called on a thread other than the GL thread.- Specified by:
getDependencies
in classAssetLoader<Skin,SkinLoader.SkinParameter>
- Parameters:
fileName
- name of the asset to loadfile
- the resolved file to loadparameter
- parameters for loading the asset- Returns:
- other assets that the asset depends on and need to be loaded first or null if there are no dependencies.
-
loadAsync
public void loadAsync(AssetManager manager, java.lang.String fileName, FileHandle file, SkinLoader.SkinParameter parameter)
Description copied from class:AsynchronousAssetLoader
Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.- Specified by:
loadAsync
in classAsynchronousAssetLoader<Skin,SkinLoader.SkinParameter>
fileName
- the name of the asset to loadfile
- the resolved file to loadparameter
- the parameters to use for loading the asset
-
loadSync
public Skin loadSync(AssetManager manager, java.lang.String fileName, FileHandle file, SkinLoader.SkinParameter parameter)
Description copied from class:AsynchronousAssetLoader
Loads the OpenGL part of the asset.- Specified by:
loadSync
in classAsynchronousAssetLoader<Skin,SkinLoader.SkinParameter>
file
- the resolved file to load
-
newSkin
protected Skin newSkin(TextureAtlas atlas)
Override to allow subclasses of Skin to be loaded or the skin instance to be configured.- Parameters:
atlas
- The TextureAtlas that the skin will use.- Returns:
- A new Skin (or subclass of Skin) instance based on the provided TextureAtlas.
-
-