|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.Image org.newdawn.slick.SpriteSheet
public class SpriteSheet
A sheet of sprites that can be drawn individually
Field Summary |
---|
Fields inherited from class org.newdawn.slick.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 Summary | |
---|---|
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 |
Method Summary | |
---|---|
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. |
Methods inherited from class org.newdawn.slick.Image |
---|
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, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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 sheet
SlickException
- Indicates a failure to read image data
java.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 tiles
SlickException
- 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 sheet
SlickException
- 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 transparent
SlickException
- 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 tiles
SlickException
- 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 sheet
SlickException
- Indicates a failure to load the imageMethod Detail |
---|
protected void initImpl()
Image
initImpl
in class Image
Image.initImpl()
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 get
public 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 sheet
public 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.endUse()
public void startUse()
Image
startUse
in class Image
Image.startUse()
public void setTexture(Texture texture)
Image
setTexture
in class Image
texture
- The texture used by this imageImage.setTexture(org.newdawn.slick.opengl.Texture)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |