public class SpriteSheet extends Image
alpha, angle, BOTTOM_LEFT, BOTTOM_RIGHT, centerX, centerY, corners, destroyed, FILTER_LINEAR, FILTER_NEAREST, GL, height, inited, inUse, name, pixelData, ref, texture, textureHeight, textureOffsetX, textureOffsetY, textureWidth, TOP_LEFT, TOP_RIGHT, width
Constructor and Description |
---|
SpriteSheet(Image image,
int tw,
int th)
Create a new sprite sheet based on a image location
|
SpriteSheet(Image image,
int tw,
int th,
int spacing)
Create a new sprite sheet based on a image location
|
SpriteSheet(Image image,
int tw,
int th,
int spacing,
int margin)
Create a new sprite sheet based on a image location
|
SpriteSheet(java.lang.String name,
java.io.InputStream ref,
int tw,
int th)
Create a new sprite sheet based on a image location
|
SpriteSheet(java.lang.String ref,
int tw,
int th)
Create a new sprite sheet based on a image location
|
SpriteSheet(java.lang.String ref,
int tw,
int th,
Color col)
Create a new sprite sheet based on a image location
|
SpriteSheet(java.lang.String ref,
int tw,
int th,
Color col,
int spacing)
Create a new sprite sheet based on a image location
|
SpriteSheet(java.lang.String ref,
int tw,
int th,
int spacing)
Create a new sprite sheet based on a image location
|
SpriteSheet(java.net.URL ref,
int tw,
int th)
Create a new sprite sheet based on a image location
|
Modifier and Type | Method and Description |
---|---|
void |
endUse()
End the use of this sprite sheet and release the lock.
|
int |
getHorizontalCount()
Get the number of sprites across the sheet
|
Image |
getSprite(int x,
int y)
Get a sprite at a particular cell on the sprite sheet
|
Image |
getSubImage(int x,
int y)
Get the sub image cached in this sprite sheet
|
int |
getVerticalCount()
Get the number of sprites down the sheet
|
protected void |
initImpl()
Hook for subclasses to perform initialisation
|
void |
renderInUse(int x,
int y,
int sx,
int sy)
Render a sprite when this sprite sheet is in use.
|
void |
setTexture(Texture texture)
Set the texture used by this image
|
void |
startUse()
Start using this sheet.
|
bind, clampTexture, copy, destroy, draw, draw, draw, draw, draw, draw, draw, draw, draw, draw, drawCentered, drawEmbedded, drawEmbedded, drawEmbedded, drawFlash, drawFlash, drawFlash, drawSheared, drawSheared, drawWarped, ensureInverted, flushPixelData, getAlpha, getBlankCopy, getCenterOfRotationX, getCenterOfRotationY, getColor, getFilter, getFlippedCopy, getGraphics, getHeight, getName, getResourceReference, getRotation, getScaledCopy, getScaledCopy, getSubImage, getTexture, getTextureHeight, getTextureOffsetX, getTextureOffsetY, getTextureWidth, getWidth, init, isDestroyed, reinit, rotate, setAlpha, setCenterOfRotation, setColor, setColor, setFilter, setImageColor, setImageColor, setName, setRotation, toString
public SpriteSheet(java.net.URL ref, int tw, int th) throws SlickException, java.io.IOException
ref
- The URL to the image to usetw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetSlickException
- Indicates a failure to read image datajava.io.IOException
- Indicates the URL could not be openedpublic SpriteSheet(Image image, int tw, int th)
image
- The image to based the sheet oftw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetpublic SpriteSheet(Image image, int tw, int th, int spacing, int margin)
image
- The image to based the sheet oftw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetspacing
- The spacing between tilesmargin
- The magrin around the tilespublic SpriteSheet(Image image, int tw, int th, int spacing)
image
- The image to based the sheet oftw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetspacing
- The spacing between tilespublic SpriteSheet(java.lang.String ref, int tw, int th, int spacing) throws SlickException
ref
- The location of the sprite sheet to loadtw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetspacing
- The spacing between tilesSlickException
- Indicates a failure to load the imagepublic SpriteSheet(java.lang.String ref, int tw, int th) throws SlickException
ref
- The location of the sprite sheet to loadtw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetSlickException
- Indicates a failure to load the imagepublic SpriteSheet(java.lang.String ref, int tw, int th, Color col) throws SlickException
ref
- The location of the sprite sheet to loadtw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetcol
- The colour to treat as transparentSlickException
- Indicates a failure to load the imagepublic SpriteSheet(java.lang.String ref, int tw, int th, Color col, int spacing) throws SlickException
ref
- The location of the sprite sheet to loadtw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetcol
- The colour to treat as transparentspacing
- The spacing between tilesSlickException
- Indicates a failure to load the imagepublic SpriteSheet(java.lang.String name, java.io.InputStream ref, int tw, int th) throws SlickException
name
- The name to give to the image in the image cacheref
- The stream from which we can load the imagetw
- The width of the tiles on the sheetth
- The height of the tiles on the sheetSlickException
- Indicates a failure to load the imageprotected void initImpl()
Image
public Image getSubImage(int x, int y)
x
- The x position in tiles of the image to gety
- The y position in tiles of the image to getpublic Image getSprite(int x, int y)
x
- The x position of the cell on the sprite sheety
- The y position of the cell on the sprite sheetpublic int getHorizontalCount()
public int getVerticalCount()
public void renderInUse(int x, int y, int sx, int sy)
x
- The x position to render the sprite aty
- The y position to render the sprite atsx
- The x location of the cell to rendersy
- The y location of the cell to renderstartUse()
,
endUse()
public void endUse()
Image
endUse
in class Image
Image.startUse()
public void startUse()
Image
public void setTexture(Texture texture)
Image
setTexture
in class Image
texture
- The texture used by this image