playn.java
Class JavaAssets
java.lang.Object
playn.core.AbstractAssets<BufferedImage>
playn.java.JavaAssets
- All Implemented Interfaces:
- Assets
public class JavaAssets
- extends AbstractAssets<BufferedImage>
Loads Java assets via the classpath.
| Methods inherited from class playn.core.AbstractAssets |
createErrorImage, createErrorImage, createRemoteErrorImage, getImage, getImageSync, getPendingRequestCount, getRemoteImage, getText, isDone, normalizePath, setErrorLater, setImageLater |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaAssets
public JavaAssets(JavaPlatform platform)
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.
setAssetScale
public void setAssetScale(float scaleFactor)
- Configures the default scale to use for assets. This allows one to specify an intermediate
graphics scale (like 1.5) and scale the 2x imagery down to 1.5x instead of scaling the 1.5x
imagery up (or displaying nothing at all).
getRemoteImage
public Image getRemoteImage(String url,
float width,
float height)
- Specified by:
getRemoteImage in interface Assets- Overrides:
getRemoteImage in class AbstractAssets<BufferedImage>
getSound
public Sound getSound(String path)
getTextSync
public String getTextSync(String path)
throws Exception
- Throws:
Exception
createStaticImage
protected Image createStaticImage(BufferedImage bufimg,
Scale scale)
- Specified by:
createStaticImage in class AbstractAssets<BufferedImage>
createAsyncImage
protected AsyncImage<BufferedImage> createAsyncImage(float width,
float height)
- Specified by:
createAsyncImage in class AbstractAssets<BufferedImage>
loadImage
protected Image loadImage(String path,
AbstractAssets.ImageReceiver<BufferedImage> recv)
- Specified by:
loadImage in class AbstractAssets<BufferedImage>
Copyright © 2012. All Rights Reserved.