playn.java
Class JavaAssetManager

java.lang.Object
  extended by playn.core.AbstractAssetManager
      extended by playn.java.JavaAssetManager
All Implemented Interfaces:
AssetManager

public class JavaAssetManager
extends AbstractAssetManager

Loads Java assets via the classpath.


Constructor Summary
JavaAssetManager()
           
 
Method Summary
protected  Image doGetImage(String path)
           
protected  Sound doGetSound(String path)
           
protected  void doGetText(String path, ResourceCallback<String> callback)
           
 String getPathPrefix()
          Returns the currently configured path prefix.
protected  URL requireResource(String path)
           
 void setPathPrefix(String prefix)
          Configures the prefix prepended to asset paths before fetching them from the classpath.
 
Methods inherited from class playn.core.AbstractAssetManager
getImage, getPendingRequestCount, getSound, getText, isDone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaAssetManager

public JavaAssetManager()
Method Detail

setPathPrefix

public void setPathPrefix(String prefix)
Configures the prefix prepended to asset paths before fetching them from the classpath. For example, if your assets are in src/main/java/com/mygame/assets (or in src/main/resources/com/mygame/assets), you can pass com/mygame/assets to this method and then load your assets without prefixing their path with that value every time. The value supplied to this method should not contain leading or trailing slashes. Note that this prefix should always use '/' as a path separator as it is used to construct URLs, not filesystem paths.


getPathPrefix

public String getPathPrefix()
Returns the currently configured path prefix. Note that this value will always have a trailing slash.


doGetImage

protected Image doGetImage(String path)
Specified by:
doGetImage in class AbstractAssetManager

doGetSound

protected Sound doGetSound(String path)
Specified by:
doGetSound in class AbstractAssetManager

doGetText

protected void doGetText(String path,
                         ResourceCallback<String> callback)
Specified by:
doGetText in class AbstractAssetManager

requireResource

protected URL requireResource(String path)
                       throws FileNotFoundException
Throws:
FileNotFoundException


Copyright © 2011. All Rights Reserved.