public class TextureManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_EXPIRATION_CHECK_INTERVAL |
protected AssetManager |
mAssets |
protected int |
mExpirationCheckElapsedTime |
protected int |
mExpirationCheckInterval |
protected GL10 |
mGL |
protected GLState |
mGLState |
protected Resources |
mResources |
protected Scene |
mScene |
protected java.util.ArrayList<Texture> |
mTextures |
static java.lang.String |
TAG |
Constructor and Description |
---|
TextureManager(Scene scene,
Resources res) |
Modifier and Type | Method and Description |
---|---|
boolean |
addTexture(Texture texture)
Add a new texture which created outside this manager
|
AssetTexture |
createAssetTexture(java.lang.String filePath,
TextureOptions options)
Create a new Texture from an AssetManager
|
AssetTexture |
createAssetTexture(java.lang.String filePath,
TextureOptions options,
boolean async)
Create a new Texture from an AssetManager asynchronously
|
BufferTexture |
createBufferTexture(int width,
int height,
boolean checkPo2)
This is used for FrameBuffer
|
DrawableTexture |
createDrawableTexture(int drawable,
TextureOptions options)
Create a new Texture from a Drawable
|
DrawableTexture |
createDrawableTexture(int drawable,
TextureOptions options,
boolean async)
Create a new Texture from a Drawable asynchronously
|
Texture |
createDynamicTexture(java.lang.Runnable loadRunnable,
TextureOptions options)
Create a new general Texture with your own reload logic
|
FileTexture |
createFileTexture(java.lang.String filePath,
TextureOptions options)
Create a new Texture from a file
|
FileTexture |
createFileTexture(java.lang.String filePath,
TextureOptions options,
boolean async)
Create a new Texture from a file asynchronously
|
TextTexture |
createTextTexture(java.lang.String text,
TextOptions options)
Create a new Text Texture
|
URLCacheTexture |
createURLCacheTexture(java.lang.String fileUrl,
java.lang.String cachePath,
TextureOptions options)
Create a new Texture from a URL and Cache synchronously
|
URLCacheTexture |
createURLCacheTexture(java.lang.String fileUrl,
java.lang.String cachePath,
TextureOptions options,
boolean async)
Create a new Texture from a URL and Cache asynchronously
|
URLTexture |
createURLTexture(java.lang.String url,
TextureOptions options)
Create a new Texture from a URL
|
URLTexture |
createURLTexture(java.lang.String url,
TextureOptions options,
boolean async)
Create a new Texture from a URL asynchronously
|
AssetManager |
getAssets() |
int |
getExpirationCheckInterval()
Get the Expiration check interval (in ms)
|
GLState |
getGLState() |
int |
getNumTextures() |
Resources |
getResources() |
Scene |
getScene() |
void |
reload(GLState glState,
Resources res)
Call this when GL changed
|
void |
reloadAllTextures(boolean includeExpiredTextures)
Can be used after the Surface reloaded.
|
void |
removeAllTextures()
Can be used after the Surface stopped.
|
void |
removeTexture(Texture texture)
Remove and Unload a specific Texture.
|
void |
setExpirationCheckInterval(int expirationCheckInterval)
Set how often (in ms) this Manager should check for all the Textures' expiration.
|
void |
unloadAllTextures()
Can be used after the Surface stopped.
|
void |
update(int deltaTime) |
public static final java.lang.String TAG
public static final int DEFAULT_EXPIRATION_CHECK_INTERVAL
protected Scene mScene
protected java.util.ArrayList<Texture> mTextures
protected GLState mGLState
protected GL10 mGL
protected Resources mResources
protected AssetManager mAssets
protected int mExpirationCheckInterval
protected int mExpirationCheckElapsedTime
public TextureManager(Scene scene, Resources res)
public Scene getScene()
public GLState getGLState()
public int getExpirationCheckInterval()
public void setExpirationCheckInterval(int expirationCheckInterval)
expirationCheckInterval
- Texture.#setExpirationTime(int)
public void reload(GLState glState, Resources res)
gl
- res
- public Resources getResources()
public AssetManager getAssets()
public DrawableTexture createDrawableTexture(int drawable, TextureOptions options)
drawable
- config
- public DrawableTexture createDrawableTexture(int drawable, TextureOptions options, boolean async)
drawable
- config
- public AssetTexture createAssetTexture(java.lang.String filePath, TextureOptions options)
assetManager
- filePath
- config
- public AssetTexture createAssetTexture(java.lang.String filePath, TextureOptions options, boolean async)
assetManager
- filePath
- config
- public FileTexture createFileTexture(java.lang.String filePath, TextureOptions options)
filePath
- config
- public FileTexture createFileTexture(java.lang.String filePath, TextureOptions options, boolean async)
filePath
- config
- public URLTexture createURLTexture(java.lang.String url, TextureOptions options)
url
- options
- public URLTexture createURLTexture(java.lang.String url, TextureOptions options, boolean async)
url
- options
- public URLCacheTexture createURLCacheTexture(java.lang.String fileUrl, java.lang.String cachePath, TextureOptions options)
fileUrl
- cachePath
- options
- public URLCacheTexture createURLCacheTexture(java.lang.String fileUrl, java.lang.String cachePath, TextureOptions options, boolean async)
fileUrl
- cachePath
- options
- async
- public TextTexture createTextTexture(java.lang.String text, TextOptions options)
text
- options
- public BufferTexture createBufferTexture(int width, int height, boolean checkPo2)
width
- height
- public Texture createDynamicTexture(java.lang.Runnable loadRunnable, TextureOptions options)
text
- options
- public boolean addTexture(Texture texture)
texture
- public void removeTexture(Texture texture)
texture
- public void reloadAllTextures(boolean includeExpiredTextures)
public void unloadAllTextures()
public void removeAllTextures()
public void update(int deltaTime)
deltaTime
- public int getNumTextures()