public class BufferedSprite extends Object implements Sprite
Sprite that initially divides the provided image into sub-images. First creation is
slower and consumes more memory than the unbuffered Sprite, but calls to get/drawTile are much
faster.| Constructor and Description |
|---|
BufferedSprite(BufferedImage image,
int width,
int height)
Creates a new
BufferedSprite. |
| Modifier and Type | Method and Description |
|---|---|
void |
drawTile(Graphics2D g,
int x,
int y,
int width,
int height)
Draws a tile of this sprite.
|
int |
getColumns()
Get the number of columns.
|
int |
getRows()
Get the number of rows.
|
Sprite |
getSubSprite(int x,
int y,
int width,
int height)
Get sub-sprite with given dimension.
|
BufferedImage |
getTile(int x,
int y)
Get a tile of this sprite.
|
int |
getTileCount()
Get the number of tiles in this sprite.
|
int |
getTileHeight()
Get the height of one tile
|
int |
getTileWidth()
Get the width of one tile
|
public BufferedSprite(BufferedImage image, int width, int height)
BufferedSprite. The given BufferedImage is copied.public void drawTile(Graphics2D g, int x, int y, int width, int height)
Bounds(0, 0,
width, height).public BufferedImage getTile(int x, int y)
drawTile(Graphics2D, int, int, int, int) for faster
action.getTile in interface Spritex - X-Coordinate of the tiley - Y-Coordinate of the tileBufferedImage containing the tilepublic int getTileCount()
SpritegetTileCount in interface Spritepublic int getRows()
Spritepublic int getColumns()
SpritegetColumns in interface Spritepublic int getTileWidth()
SpritegetTileWidth in interface Spritepublic int getTileHeight()
SpritegetTileHeight in interface Spritepublic Sprite getSubSprite(int x, int y, int width, int height)
SpriteDerivedSprite is linked with this
sprite.getSubSprite in interface Spritex - X-Coordinate of first tiley - Y-Coordinate of first tilewidth - Width of the sub-spriteheight - Height of the sub-spriteDerivedSpriteCopyright © 2017. All rights reserved.