public interface Sprite
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
|
void drawTile(Graphics2D g, int x, int y, int width, int height)
Bounds(0, 0,
width, height)
. Consider creating a clipped Graphics2D
object.g
- Graphics2D
object to draw onx
- X-Coordinate of the tiley
- Y-Coordinate of the tilewidth
- The width of the Graphics object to draw onheight
- The height of the Graphics object to draw onBufferedImage getTile(int x, int y)
drawTile(Graphics2D, int, int, int, int)
for faster action and less memory
usage.x
- X-Coordinate of the tiley
- Y-Coordinate of the tileBufferedImage
containing the tileint getTileCount()
int getRows()
int getColumns()
int getTileWidth()
int getTileHeight()
Sprite getSubSprite(int x, int y, int width, int height)
DerivedSprite
is linked with this
sprite.x
- X-Coordinate of first tiley
- Y-Coordinate of first tilewidth
- Width of the sub-spriteheight
- Height of the sub-spriteDerivedSprite
Copyright © 2017. All rights reserved.