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 @interface 
    Provides information about assets that fields or methods represent.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    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, 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, Object container)
     
    static com.badlogic.gdx.assets.AssetLoaderParameters
    getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Field field)
     
    static com.badlogic.gdx.assets.AssetLoaderParameters
    getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Field field, Object container)
     
    static com.badlogic.gdx.assets.AssetLoaderParameters
    getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Method method)
     
    static com.badlogic.gdx.assets.AssetLoaderParameters
    getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Method method, Object container)
     
    static String
    getAssetPath(com.badlogic.gdx.utils.reflect.Field field)
     
    static String
    getAssetPath(com.badlogic.gdx.utils.reflect.Field field, Object container)
     
    static String
    getAssetPath(com.badlogic.gdx.utils.reflect.Method method)
     
    static String
    getAssetPath(com.badlogic.gdx.utils.reflect.Method method, Object container)
     
    static Class
    getAssetType(com.badlogic.gdx.utils.reflect.Field field)
     
    static Class
    getAssetType(com.badlogic.gdx.utils.reflect.Field field, Object container)
     
    static Class
    getAssetType(com.badlogic.gdx.utils.reflect.Method method)
     
    static Class
    getAssetType(com.badlogic.gdx.utils.reflect.Method method, Object container)
     
    void
    load(com.badlogic.gdx.utils.reflect.Field field)
     
    void
    load(com.badlogic.gdx.utils.reflect.Field field, Object container)
     
    void
    load(com.badlogic.gdx.utils.reflect.Method method)
     
    void
    load(com.badlogic.gdx.utils.reflect.Method method, Object container)
     
    void
    load(Class<?> container)
     
    <T> void
    load(T container)
     

    Methods inherited from class com.badlogic.gdx.assets.AssetManager

    addAsset, clear, contains, contains, containsAsset, dispose, finishLoading, finishLoadingAsset, finishLoadingAsset, get, get, 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, update

    Methods 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 String getAssetPath(com.badlogic.gdx.utils.reflect.Field field, Object container)
      Parameters:
      field - the field which asset's path to get
      container - 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 String getAssetPath(com.badlogic.gdx.utils.reflect.Field field)
      See Also:
    • getAssetPath

      public static String getAssetPath(com.badlogic.gdx.utils.reflect.Method method, Object container)
      Parameters:
      method - the method which asset's path to get
      container - 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 String getAssetPath(com.badlogic.gdx.utils.reflect.Method method)
      See Also:
    • getAssetType

      public static Class getAssetType(com.badlogic.gdx.utils.reflect.Field field, Object container)
      Parameters:
      field - the field which asset's type to get
      container - 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 Class getAssetType(com.badlogic.gdx.utils.reflect.Field field)
      See Also:
    • getAssetType

      public static Class getAssetType(com.badlogic.gdx.utils.reflect.Method method, Object container)
      Parameters:
      method - the method which asset's type to get
      container - 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 Class getAssetType(com.badlogic.gdx.utils.reflect.Method method)
      See Also:
    • getAssetLoaderParameters

      public static com.badlogic.gdx.assets.AssetLoaderParameters getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Field field, Object container)
      Parameters:
      field - the field which asset's AssetLoaderParameters to get
      container - 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

      public static com.badlogic.gdx.assets.AssetLoaderParameters getAssetLoaderParameters(com.badlogic.gdx.utils.reflect.Method method, Object container)
      Parameters:
      method - the method which asset's AssetLoaderParameters to get
      container - 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:
    • createAssetDescriptor

      public static <T> com.badlogic.gdx.assets.AssetDescriptor<T> createAssetDescriptor(com.badlogic.gdx.utils.reflect.Field field, Object container)
      Parameters:
      field - the field from which to create a new AssetDescriptor
      container - 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

      public static <T> com.badlogic.gdx.assets.AssetDescriptor<T> createAssetDescriptor(com.badlogic.gdx.utils.reflect.Method method, Object container)
      Parameters:
      method - the method from which to create a new AssetDescriptor
      container - 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:
    • load

      public <T> void load(T container)
      See Also:
      • load(Class, Object)
    • load

      public void load(Class<?> container)
      See Also:
      • load(Class, Object)
    • load

      public void load(com.badlogic.gdx.utils.reflect.Field field, Object container)
      Parameters:
      field - the field which value to load
      container - 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

      public void load(com.badlogic.gdx.utils.reflect.Method method, Object container)
      Parameters:
      method - the method which return value to load
      container - 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: