public class LibgdxSpriteCache extends java.lang.Object implements SpriteCache
| Constructor and Description |
|---|
LibgdxSpriteCache() |
| Modifier and Type | Method and Description |
|---|---|
int |
add(Sprite sprite)
Adds a
Sprite to the cache. |
int |
add(Texture texture,
float x,
float y)
Adds a
Texture to the cache |
int |
add(Texture texture,
float x,
float y,
int srcX,
int srcY,
int srcWidth,
int srcHeight)
Adds a region of a
Texture to the cache |
int |
add(Texture texture,
float x,
float y,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
boolean flipX,
boolean flipY)
Adds a region of a
Texture to the cache |
int |
add(Texture texture,
float x,
float y,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
float scaleX,
float scaleY,
boolean flipX,
boolean flipY)
Adds a transformed region of a
Texture to the cache |
int |
add(Texture texture,
float x,
float y,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
float scaleX,
float scaleY,
float originX,
float originY,
float rotation,
boolean flipX,
boolean flipY)
Adds a transformed region of a
Texture to the cache |
int |
add(TextureRegion region,
float x,
float y)
Adds a
TextureRegion to the cache |
int |
add(TextureRegion region,
float x,
float y,
float scaleX,
float scaleY)
Adds a scaled
TextureRegion to the cache |
int |
add(TextureRegion region,
float x,
float y,
float scaleX,
float scaleY,
float originX,
float originY,
float rotation)
Adds a scaled
TextureRegion to the cache |
int |
add(TextureRegion region,
float x,
float y,
float scaleX,
float scaleY,
float originX,
float originY,
float rotation,
boolean flipX,
boolean flipY)
Adds a scaled
TextureRegion to the cache |
void |
beginCache()
Starts the definition of a new cache
|
void |
beginCache(int cacheID)
Starts the redefinition of an existing cache
|
void |
clear()
Invalidates all the caches and resets the SpriteCache.
|
void |
dispose()
Releases all the resources held by this SpriteCache.
|
void |
draw(Graphics g,
int cacheID)
Draws all the images defined in a SpriteCache to the screen.
|
void |
draw(Graphics g,
int cacheID,
int offset,
int length)
Draws a subset of the images defined in a SpriteCache to the screen.
|
int |
endCache()
Ends the definition of the current cache
|
Color |
getColor()
Indicates the
Color currently used to tint images when they are added to the SpriteCache |
Shader |
getCustomShader()
Indicates the custom
Shader used to draw images to the cache |
boolean |
isDrawing()
Indicates if
SpriteCache.beginCache() has been called |
void |
setColor(Color tint)
Sets the
Color used to tint images when they are added to the SpriteCache |
void |
setColor(float r,
float g,
float b,
float a)
Sets the
Color used to tint images when they are added to the SpriteCache |
void |
setCustomShader(Shader shader)
Sets the custom
Shader used to draw images to the cache |
public int add(Sprite sprite)
SpriteCacheSprite to the cache.add in interface SpriteCachesprite - The Sprite to be added.public int add(Texture texture, float x, float y)
SpriteCacheTexture to the cacheadd in interface SpriteCachetexture - The texture to be addedx - x position of the texturey - y position of the texturepublic int add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)
SpriteCacheTexture to the cacheadd in interface SpriteCachetexture - the texture to be addedx - x position of the texturey - y position of the texturesrcX - x point in the texturesrcY - y point in the texturesrcWidth - width of the region to be drawnsrcHeight - height of the region to be drawnpublic int add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)
SpriteCacheTexture to the cacheadd in interface SpriteCachetexture - the texture to be addedx - x position of the texturey - y position of the texturesrcX - x point in the texturesrcY - y point in the texturesrcWidth - width of the region to be drawnsrcHeight - height of the region to be drawnflipX - indication of whether the region should be drawn x-flippedflipY - indication of whether the region should be drawn y-flippedpublic int add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight, float scaleX, float scaleY, boolean flipX, boolean flipY)
SpriteCacheTexture to the cacheadd in interface SpriteCachetexture - the texture to be addedx - x position of the texturey - y position of the texturesrcX - x point in the texturesrcY - y point in the texturesrcWidth - width of the region to be drawnsrcHeight - height of the region to be drawnscaleX - scale of the texture in the x directionscaleY - scale of the texture in the y directionflipX - indication of whether the region should be drawn x-flippedflipY - indication of whether the region should be drawn y-flippedpublic int add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight, float scaleX, float scaleY, float originX, float originY, float rotation, boolean flipX, boolean flipY)
SpriteCacheTexture to the cacheadd in interface SpriteCachetexture - the texture to be addedx - x position of the texturey - y position of the texturesrcX - x point in the texturesrcY - y point in the texturesrcWidth - width of the region to be drawnsrcHeight - height of the region to be drawnscaleX - scale of the texture in the x directionscaleY - scale of the texture in the y directionoriginX - x position of the point around which the texture should be rotatedoriginY - y position of the point around which the texture should be rotatedrotation - rotation of the texture around the origin point (in degrees)flipX - indication of whether the region should be drawn x-flippedflipY - indication of whether the region should be drawn y-flippedpublic int add(TextureRegion region, float x, float y)
SpriteCacheTextureRegion to the cacheadd in interface SpriteCacheregion - the texture region to be addedx - x position of the texture regiony - y position of the texture regionpublic int add(TextureRegion region, float x, float y, float scaleX, float scaleY)
SpriteCacheTextureRegion to the cacheadd in interface SpriteCacheregion - the texture region to be addedx - x position of the texture regiony - y position of the texture regionscaleX - scale of the texture region in the x directionscaleY - scale of the texture region in the y directionpublic int add(TextureRegion region, float x, float y, float scaleX, float scaleY, float originX, float originY, float rotation)
SpriteCacheTextureRegion to the cacheadd in interface SpriteCacheregion - the texture region to be addedx - x position of the texture regiony - y position of the texture regionscaleX - scale of the texture region in the x directionscaleY - scale of the texture region in the y directionoriginX - x position of the point around which the region should be rotatedoriginY - y position of the point around which the region should be rotatedrotation - rotation of the texture around the origin point (in degrees)public int add(TextureRegion region, float x, float y, float scaleX, float scaleY, float originX, float originY, float rotation, boolean flipX, boolean flipY)
SpriteCacheTextureRegion to the cacheadd in interface SpriteCacheregion - the texture region to be addedx - x position of the texture regiony - y position of the texture regionscaleX - scale of the texture region in the x directionscaleY - scale of the texture region in the y directionoriginX - x position of the point around which the region should be rotatedoriginY - y position of the point around which the region should be rotatedrotation - rotation of the texture around the origin point (in degrees)flipX - indication of whether the region should be drawn x-flippedflipY - indication of whether the region should be drawn y-flippedpublic void clear()
SpriteCacheclear in interface SpriteCachepublic void dispose()
SpriteCachedispose in interface SpriteCachepublic void draw(Graphics g, int cacheID)
SpriteCachedraw in interface SpriteCacheg - the current Graphics contextcacheID - ID of the SpriteCache containing the images to draw.public void draw(Graphics g, int cacheID, int offset, int length)
SpriteCachedraw in interface SpriteCacheg - the current Graphics contextcacheID - ID of the SpriteCache containing the images to draw.offset - The index of the first image to drawlength - The number of the images to drawpublic void beginCache()
SpriteCachebeginCache in interface SpriteCachepublic void beginCache(int cacheID)
SpriteCachebeginCache in interface SpriteCachecacheID - ID of the cache to be redefinedpublic int endCache()
SpriteCacheendCache in interface SpriteCachepublic Color getColor()
SpriteCacheColor currently used to tint images when they are added to the SpriteCachegetColor in interface SpriteCachepublic void setColor(Color tint)
SpriteCacheColor used to tint images when they are added to the SpriteCachesetColor in interface SpriteCachetint - the new color to be used to tint images when they are added to the SpriteCachepublic void setColor(float r,
float g,
float b,
float a)
SpriteCacheColor used to tint images when they are added to the SpriteCachesetColor in interface SpriteCacher - The red value of the new color (0.0-1.0)g - The green value of the new color (0.0-1.0)b - The blue value of the new color (0.0-1.0)a - The alpha value of the new color (0.0-1.0)public Shader getCustomShader()
SpriteCacheShader used to draw images to the cachegetCustomShader in interface SpriteCacheShader used to draw images to the cachepublic void setCustomShader(Shader shader)
SpriteCacheShader used to draw images to the cachesetCustomShader in interface SpriteCacheshader - the new custom Shader used to draw images to the cachepublic boolean isDrawing()
SpriteCacheSpriteCache.beginCache() has been calledisDrawing in interface SpriteCache