Constructor and Description |
---|
InvertedSprite(DefaultSprite sprite,
boolean X,
boolean Y,
boolean mirror) |
InvertedSprite(DefaultSprite sprite,
boolean invertX,
boolean invertY,
boolean mirrorX,
boolean mirrorY) |
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
|
boolean |
isInvertX()
Check if X-Coordinates are inverted
|
boolean |
isInvertY()
Check if Y-Coordinates are inverted
|
boolean |
isMirrorX()
Check if tiles are mirrored left-right
|
boolean |
isMirrorY()
Check if tiles are mirrored top-bottom
|
public InvertedSprite(DefaultSprite sprite, boolean X, boolean Y, boolean mirror)
sprite
- DefaultSprite
used for this spriteX
- if true X-Axis is invertedY
- if true Y-Axis is invertedmirror
- if true the X, Y parameters are used for mirroring. Otherwise coordinates will
be inverted.public InvertedSprite(DefaultSprite sprite, boolean invertX, boolean invertY, boolean mirrorX, boolean mirrorY)
sprite
- DefaultSprite
used for this spriteinvertX
- if true X-Axis is invertedinvertY
- if true Y-Axis is invertedmirrorX
- if true the tiles will be mirrored in X direction (left-right)mirrorY
- if true the tiles will be mirrored in Y direction (top-bottom)public void drawTile(Graphics2D g, int x, int y, int width, int height)
Sprite
Bounds(0, 0,
width, height)
. Consider creating a clipped Graphics2D
object.drawTile
in interface Sprite
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 onpublic BufferedImage getTile(int x, int y)
Sprite
Sprite.drawTile(Graphics2D, int, int, int, int)
for faster action and less memory
usage.getTile
in interface Sprite
x
- X-Coordinate of the tiley
- Y-Coordinate of the tileBufferedImage
containing the tilepublic int getTileCount()
Sprite
getTileCount
in interface Sprite
public int getRows()
Sprite
public int getColumns()
Sprite
getColumns
in interface Sprite
public int getTileWidth()
Sprite
getTileWidth
in interface Sprite
public int getTileHeight()
Sprite
getTileHeight
in interface Sprite
public boolean isInvertX()
public boolean isInvertY()
public boolean isMirrorX()
public boolean isMirrorY()
public Sprite getSubSprite(int x, int y, int width, int height)
Sprite
DerivedSprite
is linked with this
sprite.getSubSprite
in interface 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.