public class JavaAssets extends AbstractAssets<BufferedImage>
| Constructor and Description |
|---|
JavaAssets(JavaPlatform platform)
Creates a new java assets.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDirectory(File dir)
Adds the given directory to the search path for resources.
|
byte[] |
getBytesSync(String path) |
Sound |
getMusic(String path) |
String |
getPathPrefix()
Returns the currently configured path prefix.
|
Image |
getRemoteImage(String url,
float width,
float height) |
Sound |
getSound(String path) |
String |
getTextSync(String path) |
void |
setAssetScale(float scaleFactor)
Configures the default scale to use for assets.
|
void |
setPathPrefix(String prefix)
Configures the prefix prepended to asset paths before fetching them from the classpath.
|
getBytes, getImage, getImageSync, getRemoteImage, getTextpublic JavaAssets(JavaPlatform platform)
public void setPathPrefix(String prefix)
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.
NOTE: the path prefix is not used when searching extra directories
public String getPathPrefix()
public void addDirectory(File dir)
TODO: remove? get?
public void setAssetScale(float scaleFactor)
public Image getRemoteImage(String url, float width, float height)
getRemoteImage in interface AssetsgetRemoteImage in class AbstractAssets<BufferedImage>public Sound getMusic(String path)
getMusic in interface AssetsgetMusic in class AbstractAssets<BufferedImage>Copyright © 2015. All Rights Reserved.