public abstract class Assets
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
RFuture<java.nio.ByteBuffer> |
getBytes(java.lang.String path)
Loads binary data asynchronously.
|
abstract java.nio.ByteBuffer |
getBytesSync(java.lang.String path)
Loads and returns the raw bytes of the asset - useful for custom binary formatted files.
|
Image |
getImage(java.lang.String path)
Asynchronously loads and returns an image.
|
Image |
getImageSync(java.lang.String path)
Synchronously loads and returns an image.
|
Sound |
getMusic(java.lang.String path)
Asynchronously loads and returns a music resource.
|
Image |
getRemoteImage(java.lang.String url)
Asynchronously loads and returns the image at the specified URL.
|
Image |
getRemoteImage(java.lang.String url,
int width,
int height)
Asynchronously loads and returns the image at the specified URL.
|
abstract Sound |
getSound(java.lang.String path)
Asynchronously loads and returns a short sound effect.
|
RFuture<java.lang.String> |
getText(java.lang.String path)
Loads UTF-8 encoded text asynchronously.
|
abstract java.lang.String |
getTextSync(java.lang.String path)
Loads and returns a UTF-8 encoded text asset.
|
public Image getImageSync(java.lang.String path)
path - the path to the image asset.java.lang.UnsupportedOperationException - on platforms that cannot support synchronous asset
loading (HTML).public Image getImage(java.lang.String path)
Image.state to be
notified when loading succeeds or fails.path - the path to the image asset.public Image getRemoteImage(java.lang.String url)
public Image getRemoteImage(java.lang.String url, int width, int height)
width and height until the image is loaded.
Note: on non-HTML platforms, this spawns a new thread for each loaded image. Thus,
attempts to load large numbers of remote images simultaneously may result in poor performance.public abstract Sound getSound(java.lang.String path)
Note: if a request to play the sound is made before the sound is loaded, it will be noted and the sound will be played when loading has completed.
path - the path to the sound resource. NOTE: this should not include a file extension,
PlayN will automatically add .mp3, (or .caf on iOS).public Sound getMusic(java.lang.String path)
getSound(java.lang.String) which is better suited to the much larger size
of music audio data.
Note: if a request to play the sound is made before the sound is loaded, it will be noted and the sound will be played when loading has completed.
path - the path to the sound resource. NOTE: this should not include a file extension,
PlayN will automatically add .mp3, (or .caf on iOS).public abstract java.lang.String getTextSync(java.lang.String path)
throws java.lang.Exception
path - the path to the text asset.java.lang.Exception - if there is an error loading the text (for example, if it does not exist).java.lang.UnsupportedOperationException - on platforms that cannot support synchronous asset
loading (e.g. HTML5 and Flash).public RFuture<java.lang.String> getText(java.lang.String path)
path - the path to the text asset.public abstract java.nio.ByteBuffer getBytesSync(java.lang.String path)
throws java.lang.Exception
path - the path to the text asset.java.lang.Exception - if there is an error loading the data (for example, if it does not exist).java.lang.UnsupportedOperationException - on platforms that cannot support synchronous asset
loading (e.g. HTML5 and Flash).public RFuture<java.nio.ByteBuffer> getBytes(java.lang.String path)
path - the path to the binary asset.Copyright © 2018. All Rights Reserved.