public interface SpriteCache
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
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 |
int add(Sprite sprite)
Sprite
to the cache.sprite
- The Sprite
to be added.int add(Texture texture, float x, float y)
Texture
to the cachetexture
- The texture to be addedx
- x position of the texturey
- y position of the textureint add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight)
Texture
to the cachetexture
- 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 drawnint add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)
Texture
to the cachetexture
- 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-flippedint add(Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight, float scaleX, float scaleY, boolean flipX, boolean flipY)
Texture
to the cachetexture
- 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-flippedint 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)
Texture
to the cachetexture
- 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-flippedint add(TextureRegion region, float x, float y)
TextureRegion
to the cacheregion
- the texture region to be addedx
- x position of the texture regiony
- y position of the texture regionint add(TextureRegion region, float x, float y, float scaleX, float scaleY)
TextureRegion
to the cacheregion
- 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 directionint add(TextureRegion region, float x, float y, float scaleX, float scaleY, float originX, float originY, float rotation)
TextureRegion
to the cacheregion
- 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)int add(TextureRegion region, float x, float y, float scaleX, float scaleY, float originX, float originY, float rotation, boolean flipX, boolean flipY)
TextureRegion
to the cacheregion
- 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-flippedvoid clear()
void dispose()
void draw(Graphics g, int cacheID)
g
- the current Graphics
contextcacheID
- ID of the SpriteCache containing the images to draw.void draw(Graphics g, int cacheID, int offset, int length)
g
- 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 drawvoid beginCache()
void beginCache(int cacheID)
cacheID
- ID of the cache to be redefinedint endCache()
Color getColor()
Color
currently used to tint images when they are added to the SpriteCachevoid setColor(Color tint)
Color
used to tint images when they are added to the SpriteCachetint
- the new color to be used to tint images when they are added to the SpriteCachevoid setColor(float r, float g, float b, float a)
Color
used to tint images when they are added to the 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)Shader getCustomShader()
Shader
used to draw images to the cacheShader
used to draw images to the cachevoid setCustomShader(Shader shader)
Shader
used to draw images to the cacheshader
- the new custom Shader
used to draw images to the cacheboolean isDrawing()
beginCache()
has been called