|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpulpcore.sprite.Sprite
pulpcore.sprite.ImageSprite
public class ImageSprite
An image-based sprite. The image can be an AnimatedImage.
To ignore the CoreImage's hotspot, call Sprite.setAnchor(int) with an
anchor other than Sprite.DEFAULT, like Sprite.NORTH_WEST.
By default, ImageSprites use pixel-level checking for intersection tests. Use
setPixelLevelChecks(boolean) to disable this feature.
| Field Summary |
|---|
| Fields inherited from class pulpcore.sprite.Sprite |
|---|
alpha, angle, CENTER, DEFAULT, EAST, enabled, height, NORTH, NORTH_EAST, NORTH_WEST, pixelSnapping, SOUTH, SOUTH_EAST, SOUTH_WEST, visible, WEST, width, x, y |
| Constructor Summary | |
|---|---|
ImageSprite(CoreImage image,
double x,
double y)
Creates an ImageSprite that has the same dimensions as the image. |
|
ImageSprite(CoreImage image,
double x,
double y,
double w,
double h)
Creates an ImageSprite that draws the image scaled to the specified dimensions. |
|
ImageSprite(CoreImage image,
int x,
int y)
Creates an ImageSprite that has the same dimensions as the image. |
|
ImageSprite(CoreImage image,
int x,
int y,
int w,
int h)
Creates an ImageSprite that draws the image scaled to the specified dimensions. |
|
ImageSprite(String imageAsset,
double x,
double y)
Creates an ImageSprite that has the same dimensions as the image. |
|
ImageSprite(String imageAsset,
double x,
double y,
double w,
double h)
Creates an ImageSprite that draws the image scaled to the specified dimensions. |
|
ImageSprite(String imageAsset,
int x,
int y)
Creates an ImageSprite that has the same dimensions as the image. |
|
ImageSprite(String imageAsset,
int x,
int y,
int w,
int h)
Creates an ImageSprite that draws the image scaled to the specified dimensions. |
|
| Method Summary | |
|---|---|
protected void |
drawSprite(CoreGraphics g)
Draws the sprite. |
protected int |
getAnchorX()
|
protected int |
getAnchorY()
|
CoreImage |
getImage()
Gets this ImageSprite's internal image. |
protected int |
getNaturalHeight()
|
protected int |
getNaturalWidth()
|
boolean |
getPixelLevelChecks()
Returns true if this sprite should use pixel-level checks for intersections and picking. |
protected boolean |
isTransparent(int localX,
int localY)
Checks if the pixel at the specified integer location is transparent. |
void |
setImage(CoreImage image)
Sets this ImageSprite's internal image. |
void |
setImage(String imageAsset)
Sets this ImageSprite's internal image. |
void |
setPixelLevelChecks(boolean pixelLevel)
Sets whether this sprite should use pixel-level checking for intersections and picking. |
void |
update(int elapsedTime)
Updates all of this Sprite's properties. |
| Methods inherited from class pulpcore.sprite.Sprite |
|---|
bindLocationTo, bindSizeTo, clearCursor, clearDirtyRect, contains, draw, getAnchor, getBlendMode, getCursor, getDirtyRect, getLocalX, getLocalY, getParent, getRoot, getScene2D, getViewX, getViewX, getViewY, getViewY, intersects, isDirty, isEnabled, isEnabledAndVisible, isMouseDoubleClicked, isMouseDown, isMouseHover, isMouseOver, isMousePressed, isMouseReleased, isMouseTripleClicked, isMouseWheelRotated, isPick, isPickEnabledAndVisible, move, move, move, move, move, move, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, propertyChange, scale, scale, scale, scale, scale, scale, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, setAnchor, setBlendMode, setCursor, setDirty, setLocation, setLocation, setSize, setSize, translate, translate, updateDirtyRect |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImageSprite(String imageAsset,
int x,
int y)
public ImageSprite(CoreImage image,
int x,
int y)
public ImageSprite(String imageAsset,
int x,
int y,
int w,
int h)
public ImageSprite(CoreImage image,
int x,
int y,
int w,
int h)
public ImageSprite(String imageAsset,
double x,
double y)
public ImageSprite(CoreImage image,
double x,
double y)
public ImageSprite(String imageAsset,
double x,
double y,
double w,
double h)
public ImageSprite(CoreImage image,
double x,
double y,
double w,
double h)
| Method Detail |
|---|
public CoreImage getImage()
public void setImage(String imageAsset)
public void setImage(CoreImage image)
public void update(int elapsedTime)
Sprite
update in class Spritepublic final void setPixelLevelChecks(boolean pixelLevel)
public final boolean getPixelLevelChecks()
getPixelLevelChecks in class SpritesetPixelLevelChecks(boolean)protected int getNaturalWidth()
getNaturalWidth in class Spriteprotected int getNaturalHeight()
getNaturalHeight in class Spriteprotected int getAnchorX()
getAnchorX in class Spriteprotected int getAnchorY()
getAnchorY in class Sprite
protected boolean isTransparent(int localX,
int localY)
SpriteThe default implementation always returns false. Subclasses of this class may need to override this method to return accurate results.
This method is called from Sprite.contains(int,int).
isTransparent in class SpritelocalX - integer x-coordinate in local spacelocalY - integer y-coordinate in local spaceprotected void drawSprite(CoreGraphics g)
Sprite
drawSprite in class Sprite
|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||