PulpCore

pulpcore.sprite
Class Sprite

java.lang.Object
  extended by pulpcore.sprite.Sprite
All Implemented Interfaces:
PropertyListener
Direct Known Subclasses:
FilledSprite, Group, ImageSprite, Label, Slider, TextField

public abstract class Sprite
extends Object
implements PropertyListener

The superclass of all sprites. Contains location, dimension, alpha, angle, visibility, and anchor information. The Sprite does no drawing - subclasses implement the drawSprite(CoreGraphics) method to draw.


Field Summary
 Int alpha
          The alpha of this Sprite, in range from 0 to 255.
 Fixed anchorX
          The x anchor point of this Sprite, in range from 0.0 to 1.0.
 Fixed anchorY
          The y anchor point of this Sprite, in range from 0.0 to 1.0.
 Fixed angle
          The angle of this Sprite, typically in range from 0 to 2*PI, although the angle can have any value.
static int CENTER
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
static int DEFAULT
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
static int EAST
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
 Bool enabled
          The flag indicating whether this Sprite is enabled.
 Fixed height
          The height of this Sprite.
static int NORTH
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
static int NORTH_EAST
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
static int NORTH_WEST
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
 Bool pixelSnapping
          Sets whether pixel snapping enabled for rendering this Sprite.
static int SOUTH
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
static int SOUTH_EAST
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
static int SOUTH_WEST
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
 Bool visible
          The flag indicating whether or not this Sprite is visible.
static int WEST
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
 Fixed width
          The width of this Sprite.
 Fixed x
          The x location of this Sprite.
 Fixed y
          The y location of this Sprite.
 
Constructor Summary
Sprite(double x, double y, double width, double height)
           
Sprite(int x, int y, int width, int height)
           
 
Method Summary
 void bindLocationTo(Sprite sprite)
          Binds this sprite's location to that of the specified sprite.
 void bindSizeTo(Sprite sprite)
          Binds this sprite's size to that of the specified sprite.
 void clearCursor()
          Clears the cursor for this Sprite, so that it's parent cursor is used.
 void clearDirtyRect()
          For dirty rectangles - most apps will not need ot call this method directly.
 boolean contains(int viewX, int viewY)
          Checks if the specified location is within the bounds of this Sprite.
 void draw(CoreGraphics g)
          Draws the Sprite.
protected abstract  void drawSprite(CoreGraphics g)
          Draws the sprite.
 BlendMode getBlendMode()
           
 int getCursor()
          Gets the cursor for this Sprite.
 Rect getDirtyRect()
          For dirty rectangles - most apps will not need ot call this method directly.
 Filter getFilter()
          Gets the image filter for this Sprite, or null if there is no filter.
 double getLocalX(double viewX, double viewY)
          Gets the integer x-coordinate in Local Space of the specified location in View Space.
 double getLocalY(double viewX, double viewY)
          Gets the integer y-coordinate in Local Space of the specified location in View Space.
protected  int getNaturalHeight()
          Gets the fixed-point value of the Sprite's natural height.
protected  int getNaturalWidth()
          Gets the fixed-point value of the Sprite's natural width.
 Group getParent()
          Gets this Sprite's parent Group, or null if this Sprite does not have a parent.
 boolean getPixelLevelChecks()
          Returns true if this sprite should use pixel-level checks for intersections and picking.
 Group getRoot()
          Gets this Sprite's oldest ancestor Group, or null if this Sprite does not have a parent.
 Scene2D getScene2D()
          Gets the Scene2D this Sprite belongs to, or null if this Sprite is not in a Scene2D.
 Object getTag()
          Gets this Sprite's tag.
 double getViewX()
          Gets the x-coordinate of this sprite in View Space.
 double getViewX(double localX, double localY)
          Gets the x-coordinate in View Space of the specified location in Local Space.
 double getViewY()
          Gets the y-coordinate of this sprite in View Space.
 double getViewY(double localX, double localY)
          Gets the y-coordinate in View Space of the specified location in Local Space.
 boolean intersects(Sprite sprite)
          Checks if the specified sprite intersects this sprite.
 boolean isDirty()
          Returns true if the Sprite's properties have changed since the last call to draw()
 boolean isEnabled()
          Returns true if this Sprite's enabled property is set to true and its parent, if any, is enabled.
 boolean isEnabledAndVisible()
          Returns true if this Sprite's enabled property is set to true, its visible property set to true, its alpha property is greater than zero, and its parent, if any, is enabled and visible.
 boolean isMouseDoubleClicked()
          Checks if this Sprite (and its parents) are enabled, the primary mouse button was double-clicked since the last update, and the double-click occurred within this Sprite's bounds.
 boolean isMouseDown()
          Checks if this Sprite (and its parents) are enabled, the mouse is currently within the bounds of this Sprite, and the primary mouse button is pressed down.
 boolean isMouseHover()
          Checks if this Sprite (and its parents) are enabled, the mouse is within the bounds of this Sprite, and the primary mouse button is not pressed down.
 boolean isMouseOver()
          Checks if this Sprite (and its parents) are enabled, and the mouse is currently within the bounds of this Sprite.
 boolean isMousePressed()
          Checks if this Sprite (and its parents) are enabled, the primary mouse button was pressed since the last update, and the press occurred within this Sprite's bounds.
 boolean isMouseReleased()
          Checks if this Sprite (and its parents) are enabled, the primary mouse button was released since the last update, and the release occurred within this Sprite's bounds.
 boolean isMouseTripleClicked()
          Checks if this Sprite (and its parents) are enabled, the primary mouse button was triple-clicked since the last update, and the triple-click occurred within this Sprite's bounds.
 boolean isMouseWheelRotated()
          Checks if this Sprite (and its parents) are enabled and the mouse wheel was rotated over this Sprite.
 boolean isOpaque()
          Returns true if this Sprite is opaque.
 boolean isPick(int viewX, int viewY)
          Checks if the specified location is within the bounds of this Sprite and this Sprite is the top-most Sprite at that location.
 boolean isPickEnabledAndVisible(int viewX, int viewY)
          Checks if the specified location is within the bounds of this Sprite and this Sprite is the top-most visible and enabled Sprite at that location.
protected  boolean isTransparent(int localX, int localY)
          Checks if the pixel at the specified integer location is transparent.
 void move(double startX, double startY, double endX, double endY, int duration)
           
 void move(double startX, double startY, double endX, double endY, int duration, Easing easing)
           
 void move(double startX, double startY, double endX, double endY, int duration, Easing easing, int startDelay)
           
 void move(int startX, int startY, int endX, int endY, int duration)
           
 void move(int startX, int startY, int endX, int endY, int duration, Easing easing)
           
 void move(int startX, int startY, int endX, int endY, int duration, Easing easing, int startDelay)
           
 void moveTo(double x, double y, int duration)
           
 void moveTo(double x, double y, int duration, Easing easing)
           
 void moveTo(double x, double y, int duration, Easing easing, int startDelay)
           
 void moveTo(int x, int y, int duration)
           
 void moveTo(int x, int y, int duration, Easing easing)
           
 void moveTo(int x, int y, int duration, Easing easing, int startDelay)
           
 void propertyChange(Property property)
          On a property change this Sprite is marked as dirty.
 void removeFromParent()
          Removes this Sprite from its parent Group.
 void scale(double width1, double height1, double width2, double height2, int duration)
           
 void scale(double width1, double height1, double width2, double height2, int duration, Easing easing)
           
 void scale(double width1, double height1, double width2, double height2, int duration, Easing easing, int startDelay)
           
 void scale(int width1, int height1, int width2, int height2, int duration)
           
 void scale(int width1, int height1, int width2, int height2, int duration, Easing easing)
           
 void scale(int width1, int height1, int width2, int height2, int duration, Easing easing, int startDelay)
           
 void scaleTo(double width, double height, int duration)
           
 void scaleTo(double width, double height, int duration, Easing easing)
           
 void scaleTo(double width, double height, int duration, Easing easing, int startDelay)
           
 void scaleTo(int width, int height, int duration)
           
 void scaleTo(int width, int height, int duration, Easing easing)
           
 void scaleTo(int width, int height, int duration, Easing easing, int startDelay)
           
 void setAnchor(double anchorX, double anchorY)
          Sets the anchor of this Sprite.
 void setAnchor(int anchor)
          Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
 void setBlendMode(BlendMode blendMode)
          Sets the blend mode used to draw this Sprite.
 void setCursor(int cursor)
          Sets the cursor for this Sprite.
 void setDirty(boolean dirty)
          Marks this Sprite as dirty, which will force it to redraw on the next frame.
 void setFilter(Filter filter)
          Sets the image filter for this Sprite.
 void setLocation(double x, double y)
          Sets the location of this Sprite.
 void setLocation(int x, int y)
          Sets the location of this Sprite.
 void setSize(double width, double height)
          Sets the size of this Sprite.
 void setSize(int width, int height)
          Sets the size of this Sprite.
 void setTag(Object tag)
          Sets this Sprite's tag.
 void translate(double x, double y)
          Translates the location of this Sprite.
 void translate(int x, int y)
          Translates the location of this Sprite.
 void update(int elapsedTime)
          Updates all of this Sprite's properties.
 boolean updateDirtyRect()
          For dirty rectangles - most apps will not need ot call this method directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final int DEFAULT
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point at the "default" location of the Sprite, which is usually its upper-left corner. One exception is ImageSprite which uses the image's hotspot at the default anchor. This is the default anchor.

See Also:
Constant Field Values

NORTH

public static final int NORTH
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the upper center of the sprite.

See Also:
Constant Field Values

SOUTH

public static final int SOUTH
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the lower center of the sprite.

See Also:
Constant Field Values

WEST

public static final int WEST
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the left center of the sprite.

See Also:
Constant Field Values

EAST

public static final int EAST
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the right center of the sprite.

See Also:
Constant Field Values

NORTH_WEST

public static final int NORTH_WEST
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the upper left corner of the sprite.

See Also:
Constant Field Values

NORTH_EAST

public static final int NORTH_EAST
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the upper right corner of the sprite.

See Also:
Constant Field Values

SOUTH_WEST

public static final int SOUTH_WEST
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the lower left corner of the sprite.

See Also:
Constant Field Values

SOUTH_EAST

public static final int SOUTH_EAST
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the lower right corner of the sprite.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.
Constant for positioning the anchor point in the center of the sprite.

See Also:
Constant Field Values

enabled

public final Bool enabled
The flag indicating whether this Sprite is enabled. An enabled sprite can respond to user input. Sprites are enabled by default.


x

public final Fixed x
The x location of this Sprite.


y

public final Fixed y
The y location of this Sprite.


width

public final Fixed width
The width of this Sprite.


height

public final Fixed height
The height of this Sprite.


anchorX

public final Fixed anchorX
The x anchor point of this Sprite, in range from 0.0 to 1.0. A value of 0.0 is far left point of the Sprite and a value of 1.0 is far right point. The default is 0.0.


anchorY

public final Fixed anchorY
The y anchor point of this Sprite, in range from 0.0 to 1.0. A value of 0.0 is far top point of the Sprite and a value of 1.0 is far bottom point. The default is 0.0.


angle

public final Fixed angle
The angle of this Sprite, typically in range from 0 to 2*PI, although the angle can have any value. The Sprite is rotated around its anchor.


alpha

public final Int alpha
The alpha of this Sprite, in range from 0 to 255. A value of 0 is fully transparent and a value of 255 is fully opaque. The default is 255.


visible

public final Bool visible
The flag indicating whether or not this Sprite is visible.


pixelSnapping

public final Bool pixelSnapping
Sets whether pixel snapping enabled for rendering this Sprite. If this value is true, only the integer portion of the x and y properties are used to draw this sprite.

Enabling pixel snapping may allow some type of images (e.g. pixel art) to look better.

This value is false by default.

Constructor Detail

Sprite

public Sprite(int x,
              int y,
              int width,
              int height)

Sprite

public Sprite(double x,
              double y,
              double width,
              double height)
Method Detail

getTag

public Object getTag()
Gets this Sprite's tag.

See Also:
setTag(Object), Group.findWithTag(Object)

setTag

public void setTag(Object tag)
Sets this Sprite's tag. The tag can be used for marking the sprite or storing information with it. Different Sprites can share identical tags. By default, the tag is null.

See Also:
getTag(), Group.findWithTag(Object)

isOpaque

public boolean isOpaque()
Returns true if this Sprite is opaque. In other words, before applying transforms and alpha, all the pixels within it's bounds are drawn and are themselves opaque.

Returns false by default.


getParent

public final Group getParent()
Gets this Sprite's parent Group, or null if this Sprite does not have a parent.


removeFromParent

public void removeFromParent()
Removes this Sprite from its parent Group. If this Sprite does not have a parent, this method does nothing.


getRoot

public final Group getRoot()
Gets this Sprite's oldest ancestor Group, or null if this Sprite does not have a parent.


getScene2D

public Scene2D getScene2D()
Gets the Scene2D this Sprite belongs to, or null if this Sprite is not in a Scene2D.


isEnabled

public final boolean isEnabled()
Returns true if this Sprite's enabled property is set to true and its parent, if any, is enabled.


isEnabledAndVisible

public final boolean isEnabledAndVisible()
Returns true if this Sprite's enabled property is set to true, its visible property set to true, its alpha property is greater than zero, and its parent, if any, is enabled and visible.


getDirtyRect

public final Rect getDirtyRect()
For dirty rectangles - most apps will not need ot call this method directly.


updateDirtyRect

public final boolean updateDirtyRect()
For dirty rectangles - most apps will not need ot call this method directly.


clearDirtyRect

public final void clearDirtyRect()
For dirty rectangles - most apps will not need ot call this method directly.


setDirty

public final void setDirty(boolean dirty)
Marks this Sprite as dirty, which will force it to redraw on the next frame.


isDirty

public final boolean isDirty()
Returns true if the Sprite's properties have changed since the last call to draw()


getNaturalWidth

protected int getNaturalWidth()
Gets the fixed-point value of the Sprite's natural width. Subclasses will override this method to specify the natural width. The natural width is the width of the Sprite if no scaling is applied - for an ImageSprite, the natural width is the width of the image.


getNaturalHeight

protected int getNaturalHeight()
Gets the fixed-point value of the Sprite's natural height. Subclasses will override this method to specify the natural height. The natural height is the height of the Sprite if no scaling is applied - for an ImageSprite, the natural height is the height of the image.


setAnchor

public void setAnchor(int anchor)
Deprecated. Compass directions are being phased out - Use setAnchor(double, double) instead.

Sets the anchor of this Sprite. The anchor affects where the Sprite is drawn in relation to its (x, y) location, and can be one of DEFAULT, NORTH, SOUTH, WEST, EAST, NORTH_WEST, SOUTH_WEST, NORTH_EAST, SOUTH_EAST, or CENTER.

        NW     N     NE
          +----+----+
          |         |
        W +    *    + E
          |         |
          +----+----+
        SW     S     SE
        
The DEFAULT anchor is equivalent to NORTH_WEST for most Sprites (except for ImageSprites, which use the CoreImage's hotspot as the anchor).


setAnchor

public final void setAnchor(double anchorX,
                            double anchorY)
Sets the anchor of this Sprite. The anchor affects where the Sprite is drawn in relation to its (x, y) location. The anchor of each axis is typically from 0.0 (top/left) and 1.0 (bottom/right):
        (0.0,0.0)  (0.5,0.0)  (1.0,0.0)
            +----------+----------+
            |                     |
            |                     |
            |                     |
            |      (0.5,0.5)      |
  (0.0,0.5) +          *          + (1.0,0.5)
            |                     |
            |                     |
            |                     |
            |                     |
            +----------+----------+
        (0.0,0.0)  (0.5,1.0)  (1.0,1.0)
        
For example, to center the Sprite at it's (x,y) location, use sprite.setAnchor(0.5, 0.5);

See Also:
anchorX, anchorY

setCursor

public final void setCursor(int cursor)
Sets the cursor for this Sprite. By default, a Sprite does not have a defined cursor. Note, the Sprite itself does not set the cursor - it is set by Scene2D.

See Also:
Input, getCursor(), clearCursor()

clearCursor

public final void clearCursor()
Clears the cursor for this Sprite, so that it's parent cursor is used.

See Also:
Input, getCursor(), setCursor(int)

getCursor

public final int getCursor()
Gets the cursor for this Sprite. If a cursor is not defined for this Sprite, the parent's cursor is used.

See Also:
Input, setCursor(int), clearCursor()

setBlendMode

public final void setBlendMode(BlendMode blendMode)
Sets the blend mode used to draw this Sprite. By default, the blend mode method is null, which means the blend mode of this Sprite's parent is used.

See Also:
BlendMode

getBlendMode

public final BlendMode getBlendMode()

setFilter

public final void setFilter(Filter filter)
Sets the image filter for this Sprite. If this Sprite is a Group with no backbuffer, a backbuffer is created. The default filter is null.

If the specified filter is already attached to a Sprite, a clone of it is created.

See Also:
getFilter()

getFilter

public final Filter getFilter()
Gets the image filter for this Sprite, or null if there is no filter.

See Also:
setFilter(pulpcore.image.filter.Filter)

update

public void update(int elapsedTime)
Updates all of this Sprite's properties. Subclasses that override this method should call super.update().


propertyChange

public void propertyChange(Property property)
On a property change this Sprite is marked as dirty.

Specified by:
propertyChange in interface PropertyListener
Parameters:
property - the property whose value has changed.

draw

public final void draw(CoreGraphics g)
Draws the Sprite. Subclasses override drawSprite(pulpcore.image.CoreGraphics).


drawSprite

protected abstract void drawSprite(CoreGraphics g)
Draws the sprite. The graphic context's alpha is set to this sprite's alpha, and it's translation is offset by this sprite's location. This method is not called if the sprite is not visible or it's alpha is less than or equal to zero.

This method may be called multiple times for each dirty rectangle. The clip of the graphics context will be set to the current dirty rectangle.

When the contents of this sprite change (in another words, the graphic output of this method will be different from the last time it is called), subclasses should call setDirty(true).

Implementors should not save a reference to the graphics context as it can change between calls to this method.


getLocalX

public final double getLocalX(double viewX,
                              double viewY)
Gets the integer x-coordinate in Local Space of the specified location in View Space. Returns Double.MAX_VALUE if the Local Space is invalid (that is, it's Transform determinant is zero).


getLocalY

public final double getLocalY(double viewX,
                              double viewY)
Gets the integer y-coordinate in Local Space of the specified location in View Space. Returns Double.MAX_VALUE if the Local Space is invalid (that is, it's Transform determinant is zero).


getViewX

public final double getViewX()
Gets the x-coordinate of this sprite in View Space.


getViewY

public final double getViewY()
Gets the y-coordinate of this sprite in View Space.


getViewX

public final double getViewX(double localX,
                             double localY)
Gets the x-coordinate in View Space of the specified location in Local Space.


getViewY

public final double getViewY(double localX,
                             double localY)
Gets the y-coordinate in View Space of the specified location in Local Space.


contains

public final boolean contains(int viewX,
                              int viewY)
Checks if the specified location is within the bounds of this Sprite.

Parameters:
viewX - x-coordinate in view space
viewY - y-coordinate in view space
Returns:
true if the specified point is within the bounds of this Sprite.

getPixelLevelChecks

public boolean getPixelLevelChecks()
Returns true if this sprite should use pixel-level checks for intersections and picking.

This method returns false. Subclasses of Sprite should override this method if they have pixel-level checks in their implementation of isTransparent(int, int).


isTransparent

protected boolean isTransparent(int localX,
                                int localY)
Checks if the pixel at the specified integer location is transparent. This method does not check if this sprite is enabled or visible, nor does it check its alpha value.

The default implementation always returns false. Subclasses of this class may need to override this method to return accurate results.

This method is called from contains(int,int).

Parameters:
localX - integer x-coordinate in local space
localY - integer y-coordinate in local space

isPick

public final boolean isPick(int viewX,
                            int viewY)
Checks if the specified location is within the bounds of this Sprite and this Sprite is the top-most Sprite at that location.

Parameters:
viewX - x-coordinate in view space
viewY - y-coordinate in view space

isPickEnabledAndVisible

public final boolean isPickEnabledAndVisible(int viewX,
                                             int viewY)
Checks if the specified location is within the bounds of this Sprite and this Sprite is the top-most visible and enabled Sprite at that location.

Parameters:
viewX - x-coordinate in view space
viewY - y-coordinate in view space

intersects

public boolean intersects(Sprite sprite)
Checks if the specified sprite intersects this sprite. This method checks if this sprite's OBB (oriented bounding box) intersects with the specified sprite's OBB. The OBBs can be parallelograms in some cases.

The two sprites do no have to be in the same Group.

Parameters:
sprite - the sprite to test against.
Returns:
true if the two sprites' OBBs intersect.

isMouseOver

public boolean isMouseOver()
Checks if this Sprite (and its parents) are enabled, and the mouse is currently within the bounds of this Sprite.

For a typical button UI button behavior, use Button.

Returns:
true if the mouse is currently within the bounds of this Sprite.

isMouseHover

public boolean isMouseHover()
Checks if this Sprite (and its parents) are enabled, the mouse is within the bounds of this Sprite, and the primary mouse button is not pressed down.

For a typical button UI button behavior, use Button.

Returns:
true if the mouse is currently within the bounds of this Sprite and the primary mouse button is not pressed down.

isMouseDown

public boolean isMouseDown()
Checks if this Sprite (and its parents) are enabled, the mouse is currently within the bounds of this Sprite, and the primary mouse button is pressed down.

For a typical button UI button behavior, use Button.

Returns:
true if the mouse is currently within the bounds of this Sprite and the primary mouse button is pressed down.

isMousePressed

public boolean isMousePressed()
Checks if this Sprite (and its parents) are enabled, the primary mouse button was pressed since the last update, and the press occurred within this Sprite's bounds.

For a typical button UI button behavior, use Button.

Returns:
true if the primary mouse button was pressed since the last update and the press occurred within this Sprite's bounds.

isMouseReleased

public boolean isMouseReleased()
Checks if this Sprite (and its parents) are enabled, the primary mouse button was released since the last update, and the release occurred within this Sprite's bounds.

For a typical button UI button behavior, use Button.

Returns:
true if the primary mouse button was released since the last update and the release occurred within this Sprite's bounds.

isMouseDoubleClicked

public boolean isMouseDoubleClicked()
Checks if this Sprite (and its parents) are enabled, the primary mouse button was double-clicked since the last update, and the double-click occurred within this Sprite's bounds.

For a typical button UI button behavior, use Button.

Returns:
true if the primary mouse button was double-clicked since the last update and the double-click occurred within this Sprite's bounds.

isMouseTripleClicked

public boolean isMouseTripleClicked()
Checks if this Sprite (and its parents) are enabled, the primary mouse button was triple-clicked since the last update, and the triple-click occurred within this Sprite's bounds.

For a typical button UI button behavior, use Button.

Returns:
true if the primary mouse button was triple-clicked since the last update and the triple-click occurred within this Sprite's bounds.

isMouseWheelRotated

public boolean isMouseWheelRotated()
Checks if this Sprite (and its parents) are enabled and the mouse wheel was rotated over this Sprite.

Returns:
true if the mouse wheel was rotated over this sprite since the last rendering frame.

setLocation

public void setLocation(int x,
                        int y)
Sets the location of this Sprite.


setLocation

public void setLocation(double x,
                        double y)
Sets the location of this Sprite.


translate

public void translate(int x,
                      int y)
Translates the location of this Sprite.


translate

public void translate(double x,
                      double y)
Translates the location of this Sprite.


setSize

public void setSize(int width,
                    int height)
Sets the size of this Sprite. Changing the size is non-destructive - for example, an ImageSprite doesn't internally scale it's image when this method is called. Instead, an ImageSprite uses appropriate CoreGraphics methods to draw a scaled version of its image.


setSize

public void setSize(double width,
                    double height)
Sets the size of this Sprite. Changing the size is non-destructive - for example, an ImageSprite doesn't internally scale it's image when this method is called. Instead, an ImageSprite uses appropriate CoreGraphics methods to draw a scaled version of its image.


bindLocationTo

public void bindLocationTo(Sprite sprite)
Binds this sprite's location to that of the specified sprite.


bindSizeTo

public void bindSizeTo(Sprite sprite)
Binds this sprite's size to that of the specified sprite.


move

public void move(int startX,
                 int startY,
                 int endX,
                 int endY,
                 int duration)

move

public void move(int startX,
                 int startY,
                 int endX,
                 int endY,
                 int duration,
                 Easing easing)

move

public void move(int startX,
                 int startY,
                 int endX,
                 int endY,
                 int duration,
                 Easing easing,
                 int startDelay)

moveTo

public void moveTo(int x,
                   int y,
                   int duration)

moveTo

public void moveTo(int x,
                   int y,
                   int duration,
                   Easing easing)

moveTo

public void moveTo(int x,
                   int y,
                   int duration,
                   Easing easing,
                   int startDelay)

move

public void move(double startX,
                 double startY,
                 double endX,
                 double endY,
                 int duration)

move

public void move(double startX,
                 double startY,
                 double endX,
                 double endY,
                 int duration,
                 Easing easing)

move

public void move(double startX,
                 double startY,
                 double endX,
                 double endY,
                 int duration,
                 Easing easing,
                 int startDelay)

moveTo

public void moveTo(double x,
                   double y,
                   int duration)

moveTo

public void moveTo(double x,
                   double y,
                   int duration,
                   Easing easing)

moveTo

public void moveTo(double x,
                   double y,
                   int duration,
                   Easing easing,
                   int startDelay)

scale

public void scale(int width1,
                  int height1,
                  int width2,
                  int height2,
                  int duration)

scale

public void scale(int width1,
                  int height1,
                  int width2,
                  int height2,
                  int duration,
                  Easing easing)

scale

public void scale(int width1,
                  int height1,
                  int width2,
                  int height2,
                  int duration,
                  Easing easing,
                  int startDelay)

scaleTo

public void scaleTo(int width,
                    int height,
                    int duration)

scaleTo

public void scaleTo(int width,
                    int height,
                    int duration,
                    Easing easing)

scaleTo

public void scaleTo(int width,
                    int height,
                    int duration,
                    Easing easing,
                    int startDelay)

scale

public void scale(double width1,
                  double height1,
                  double width2,
                  double height2,
                  int duration)

scale

public void scale(double width1,
                  double height1,
                  double width2,
                  double height2,
                  int duration,
                  Easing easing)

scale

public void scale(double width1,
                  double height1,
                  double width2,
                  double height2,
                  int duration,
                  Easing easing,
                  int startDelay)

scaleTo

public void scaleTo(double width,
                    double height,
                    int duration)

scaleTo

public void scaleTo(double width,
                    double height,
                    int duration,
                    Easing easing)

scaleTo

public void scaleTo(double width,
                    double height,
                    int duration,
                    Easing easing,
                    int startDelay)

PulpCore

Copyright © 2007-2009 Interactive Pulp, LLC.