Package net.dermetfan.gdx.assets
Class AnnotationAssetManager
java.lang.Object
com.badlogic.gdx.assets.AssetManager
net.dermetfan.gdx.assets.AnnotationAssetManager
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
public class AnnotationAssetManager
extends com.badlogic.gdx.assets.AssetManager
an AssetManager that loads assets from annotated fields and methods using reflection
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAnnotationAssetManager.AssetProvides information about assets that fields or methods represent. -
Constructor Summary
Constructors Constructor Description AnnotationAssetManager()AnnotationAssetManager(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver)AnnotationAssetManager(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver, boolean defaultLoaders) -
Method Summary
Modifier and Type Method Description static <T> com.badlogic.gdx.assets.AssetDescriptor<T>createAssetDescriptor(com.badlogic.gdx.utils.reflect.Field field)static <T> com.badlogic.gdx.assets.AssetDescriptor<T>createAssetDescriptor(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)static <T> com.badlogic.gdx.assets.AssetDescriptor<T>createAssetDescriptor(com.badlogic.gdx.utils.reflect.Method method)static <T> com.badlogic.gdx.assets.AssetDescriptor<T>createAssetDescriptor(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)static com.badlogic.gdx.assets.AssetLoaderParametersgetAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Field field)static com.badlogic.gdx.assets.AssetLoaderParametersgetAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)static com.badlogic.gdx.assets.AssetLoaderParametersgetAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Method method)static com.badlogic.gdx.assets.AssetLoaderParametersgetAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)static java.lang.StringgetAssetPath(com.badlogic.gdx.utils.reflect.Field field)static java.lang.StringgetAssetPath(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)static java.lang.StringgetAssetPath(com.badlogic.gdx.utils.reflect.Method method)static java.lang.StringgetAssetPath(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)static java.lang.ClassgetAssetType(com.badlogic.gdx.utils.reflect.Field field)static java.lang.ClassgetAssetType(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)static java.lang.ClassgetAssetType(com.badlogic.gdx.utils.reflect.Method method)static java.lang.ClassgetAssetType(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)voidload(com.badlogic.gdx.utils.reflect.Field field)voidload(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)voidload(com.badlogic.gdx.utils.reflect.Method method)voidload(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)voidload(java.lang.Class<?> container)<T> voidload(T container)Methods inherited from class com.badlogic.gdx.assets.AssetManager
addAsset, clear, contains, contains, containsAsset, dispose, finishLoading, finishLoadingAsset, finishLoadingAsset, get, get, get, getAll, getAssetFileName, getAssetNames, getAssetType, getDependencies, getDiagnostics, getFileHandleResolver, getLoadedAssets, getLoader, getLoader, getLogger, getProgress, getQueuedAssets, getReferenceCount, isFinished, isLoaded, isLoaded, isLoaded, load, load, load, setErrorListener, setLoader, setLoader, setLogger, setReferenceCount, taskFailed, unload, update, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AnnotationAssetManager
public AnnotationAssetManager() -
AnnotationAssetManager
public AnnotationAssetManager(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver) -
AnnotationAssetManager
public AnnotationAssetManager(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver, boolean defaultLoaders)
-
-
Method Details
-
getAssetPath
public static java.lang.String getAssetPath(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)- Parameters:
field- the field which asset's path to getcontainer- An instance of the field's declaring class. May be null if it's static.- Returns:
- the path of the given field's asset
-
getAssetPath
public static java.lang.String getAssetPath(com.badlogic.gdx.utils.reflect.Field field)- See Also:
getAssetPath(Field, Object)
-
getAssetPath
public static java.lang.String getAssetPath(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)- Parameters:
method- the method which asset's path to getcontainer- An instance of the method's declaring class. May be null if it's static.- Returns:
- the path of the given method's asset
-
getAssetPath
public static java.lang.String getAssetPath(com.badlogic.gdx.utils.reflect.Method method)- See Also:
getAssetPath(Method, Object)
-
getAssetType
public static java.lang.Class getAssetType(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)- Parameters:
field- the field which asset's type to getcontainer- An instance of the field's declaring class. May be null if it's static.- Returns:
- the type of the given field's asset
-
getAssetType
public static java.lang.Class getAssetType(com.badlogic.gdx.utils.reflect.Field field)- See Also:
getAssetType(Field, Object)
-
getAssetType
public static java.lang.Class getAssetType(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)- Parameters:
method- the method which asset's type to getcontainer- An instance of the method's declaring class. May be null if it's static.- Returns:
- the type of the given method's asset
-
getAssetType
public static java.lang.Class getAssetType(com.badlogic.gdx.utils.reflect.Method method)- See Also:
getAssetType(Method, Object)
-
getAssetLoaderParameters
public static com.badlogic.gdx.assets.AssetLoaderParameters getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)- Parameters:
field- the field which asset's AssetLoaderParameters to getcontainer- An instance of the field's declaring class. May be null if it's static.- Returns:
- the AssetLoaderParameters to use with the given field's asset
-
getAssetLoaderParameters
public static com.badlogic.gdx.assets.AssetLoaderParameters getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Field field)- See Also:
getAssetLoaderParameters(Field, Object)
-
getAssetLoaderParameters
public static com.badlogic.gdx.assets.AssetLoaderParameters getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)- Parameters:
method- the method which asset's AssetLoaderParameters to getcontainer- An instance of the method's declaring class. May be null if it's static.- Returns:
- the AssetLoaderParameters to use with the given method's asset
-
getAssetLoaderParameters
public static com.badlogic.gdx.assets.AssetLoaderParameters getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Method method)- See Also:
getAssetLoaderParameters(Method, Object)
-
createAssetDescriptor
public static <T> com.badlogic.gdx.assets.AssetDescriptor<T> createAssetDescriptor(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)- Parameters:
field- the field from which to create a new AssetDescriptorcontainer- An instance of the field's declaring class. May be null if it's static.- Returns:
- a new AssetDescriptor created from the given field
-
createAssetDescriptor
public static <T> com.badlogic.gdx.assets.AssetDescriptor<T> createAssetDescriptor(com.badlogic.gdx.utils.reflect.Field field)- See Also:
createAssetDescriptor(Field, Object)
-
createAssetDescriptor
public static <T> com.badlogic.gdx.assets.AssetDescriptor<T> createAssetDescriptor(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)- Parameters:
method- the method from which to create a new AssetDescriptorcontainer- An instance of the method's declaring class. May be null if it's static.- Returns:
- a new AssetDescriptor created from the given method
-
createAssetDescriptor
public static <T> com.badlogic.gdx.assets.AssetDescriptor<T> createAssetDescriptor(com.badlogic.gdx.utils.reflect.Method method)- See Also:
createAssetDescriptor(Method, Object)
-
load
public <T> void load(T container)- See Also:
load(Class, Object)
-
load
public void load(java.lang.Class<?> container)- See Also:
load(Class, Object)
-
load
public void load(com.badlogic.gdx.utils.reflect.Field field, java.lang.Object container)- Parameters:
field- the field which value to loadcontainer- An instance of the field's declaring class. May be null if it's static.
-
load
public void load(com.badlogic.gdx.utils.reflect.Field field)- See Also:
load(Field, Object)
-
load
public void load(com.badlogic.gdx.utils.reflect.Method method, java.lang.Object container)- Parameters:
method- the method which return value to loadcontainer- An instance of the method's declaring class. May be null if it's static.
-
load
public void load(com.badlogic.gdx.utils.reflect.Method method)- See Also:
load(Method, Object)
-