public class AndroidAssets extends Assets
| Modifier and Type | Class and Description |
|---|---|
class |
AndroidAssets.BitmapOptions
Extends
BitmapFactory.Options with PlayN asset scale configuration. |
static interface |
AndroidAssets.BitmapOptionsAdjuster
|
| Constructor and Description |
|---|
AndroidAssets(AndroidPlatform plat) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBytesSync(String path) |
Sound |
getMusic(String path) |
Image |
getRemoteImage(String url,
int width,
int height) |
Sound |
getSound(String path) |
String |
getTextSync(String path) |
android.graphics.Typeface |
getTypeface(String path)
Loads a typeface from
path. |
void |
setAssetScale(float scaleFactor)
Configures the default scale to use for assets.
|
void |
setBitmapOptionsAdjuster(AndroidAssets.BitmapOptionsAdjuster optionsAdjuster)
Configures a class that will adjust the
AndroidAssets.BitmapOptions used to decode loaded bitmaps. |
void |
setExpansionFile(int mainVersion,
int patchVersion)
Configures assets to be loaded from existing expansion files.
|
void |
setPathPrefix(String prefix)
Configures a prefix which is prepended to all asset paths prior to loading.
|
getBytes, getImage, getImageSync, getRemoteImage, getTextpublic AndroidAssets(AndroidPlatform plat)
public void setPathPrefix(String prefix)
assets directory. This prefix is thus inserted between assets and the path supplied
to any of the various get methods.public void setExpansionFile(int mainVersion,
int patchVersion)
throws IOException
0 for the version. Both files will be searched for
resources.
Expansion resources do not make an assumption that the resources are in a directory named
'assets' in contrast to the Android resource manager. Use setPathPrefix(java.lang.String) to configure
the path within the expansion files.
Expansion files are expected to be existing and zipped, following the Android expansion file guidelines.
Due to Android limitations, fonts and typefaces can not be loaded from expansion files. Fonts should be kept within the default Android assets directory so they may be loaded via the AssetManager.
IOException - if any expansion files are missing.public void setAssetScale(float scaleFactor)
public void setBitmapOptionsAdjuster(AndroidAssets.BitmapOptionsAdjuster optionsAdjuster)
AndroidAssets.BitmapOptions used to decode loaded bitmaps.
An app may wish to use different bitmap configs for different images (say RGB_565 for
its non-transparent images) or adjust the dithering settings.public android.graphics.Typeface getTypeface(String path)
path. This can then be registered via
AndroidGraphics.registerFont(android.graphics.Typeface, java.lang.String, playn.core.Font.Style, java.lang.String...).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.