public class JavaAssets extends AbstractAssets<BufferedImage>
AbstractAssets.ImageReceiver<I>| Constructor and Description |
|---|
JavaAssets(JavaPlatform platform) |
| Modifier and Type | Method and Description |
|---|---|
protected Scale |
assetScale() |
protected AsyncImage<BufferedImage> |
createAsyncImage(float width,
float height) |
protected Image |
createStaticImage(BufferedImage bufimg,
Scale scale) |
protected InputStream |
getAssetStream(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) |
protected Sound |
getSound(String path,
boolean music) |
String |
getTextSync(String path) |
protected Image |
loadImage(String path,
AbstractAssets.ImageReceiver<BufferedImage> recv) |
protected URL |
requireResource(String path) |
protected BufferedImage |
scaleImage(BufferedImage image,
float viewImageRatio) |
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.
|
createErrorImage, createErrorImage, createRemoteErrorImage, getImage, getImageSync, getRemoteImage, getText, normalizePath, setErrorLater, setImageLaterprotected static final String[] SUFFIXES
public 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.public String getPathPrefix()
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>protected Image createStaticImage(BufferedImage bufimg, Scale scale)
createStaticImage in class AbstractAssets<BufferedImage>protected AsyncImage<BufferedImage> createAsyncImage(float width, float height)
createAsyncImage in class AbstractAssets<BufferedImage>protected Image loadImage(String path, AbstractAssets.ImageReceiver<BufferedImage> recv)
loadImage in class AbstractAssets<BufferedImage>protected InputStream getAssetStream(String path) throws IOException
IOExceptionprotected URL requireResource(String path) throws FileNotFoundException
FileNotFoundExceptionprotected BufferedImage scaleImage(BufferedImage image, float viewImageRatio)
protected Scale assetScale()
Copyright © 2013. All Rights Reserved.