public class JavaAssets extends Assets
| Constructor and Description |
|---|
JavaAssets(JavaPlatform plat)
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,
int width,
int 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 plat)
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, int width, int height)
getRemoteImage in class Assetspublic String getTextSync(String path) throws Exception
getTextSync in class AssetsExceptionpublic byte[] getBytesSync(String path) throws Exception
getBytesSync in class AssetsExceptionCopyright © 2015. All Rights Reserved.