Pixel Dust Game Engine  v0.9.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
Sprite Class Reference
Inheritance diagram for Sprite:
Inheritance graph
[legend]
Collaboration diagram for Sprite:
Collaboration graph
[legend]

Public Types

enum  {
  animate_StartToEnd = 0,
  animate_EndToStart = 1,
  animate_Unidirectional = 0,
  animate_Bidirectional = 2,
  animate_NoLooping = 0,
  animate_Looping = 4,
  start_FromFirstFrame = -1,
  start_FromLastFrame = -2,
  all_Frames = 0,
  action_CollideSprite = 0,
  action_CollideWall = 1,
  action_Offscreen = 2,
  action_Onscreen = 3,
  action_ExitLayer = 4,
  action_AnimationLoop = 8,
  action_AnimationEnd = 9,
  action_FadeComplete = 10,
  action_FadeInComplete = 11,
  action_FadeOutComplete = 12,
  action_JointBreak = 13,
  touch_MouseEnter = 20,
  touch_MouseLeave = 21,
  touch_MouseDown = 22,
  touch_MouseUp = 23,
  touch_MouseClick = 24,
  collide_None = 0,
  collide_Point = 1,
  collide_BoundingBox = 2,
  collide_CollisionRadius = 3,
  collide_AlphaChannel = 4,
  collide_Last = collide_AlphaChannel
}
 
- Public Types inherited from Animated
enum  {
  duration_Constant = -1,
  duration_Instantaneous = 0
}
 

Public Member Functions

 SERIALIZABLE_TAG (CLASSTAG_SPRITE)
 
 SERIALIZABLE_METHODS ()
 
RotatedRect getFrameRotatedBounds (int frameNum=-1)
 
SpritesetFrame (int frame)
 
int getCurrentFrame ()
 
int getFrameCount ()
 
void startFrameAnimation (float fps, int startingFrame=start_FromFirstFrame, int numFrames=all_Frames, int animateFlags=animate_Looping)
 
void stopFrameAnimation ()
 
bool getWantsAnimLoopEvents ()
 
bool getWantsAnimEndEvents ()
 
SpritesetWantsAnimLoopEvents (bool wantsThem=true)
 
SpritesetWantsAnimEndEvents (bool wantsThem=true)
 
void addFramesImage (Image *image, int startingFrame=start_FromFirstFrame, int numFrames=all_Frames)
 
void setDrawHelper (ISpriteDrawHelper *helper)
 
void setPostDrawHelper (ISpriteDrawHelper *helper)
 
void changeFramesImage (Image *oldImage, Image *newImage)
 
void offsetFrameCenters (int offsetX, int offsetY, Image *image=0, int startingFrame=start_FromFirstFrame, int numFrames=all_Frames)
 
Offset getFrameCenterOffset (Image *image=0, int frameNum=0)
 
SpritesetOpacity (float opacity)
 
float getOpacity ()
 
void fadeTo (float targetOpacity, ms_delta msDuration, EasingFunc easing=linearTween)
 
void fadeIn (ms_delta msDuration, EasingFunc easing=linearTween)
 
void fadeOut (ms_delta msDuration, EasingFunc easing=linearTween)
 
SpritemoveBehind (Sprite *sprite)
 
SpritemoveInFrontOf (Sprite *sprite)
 
SpritemoveToFront ()
 
SpritemoveToBack ()
 
int getZOrder ()
 
bool isBehind (Sprite *sprite)
 
bool getWantsCollideWallEvents ()
 
SpritesetWantsCollideWallEvents (bool wantsThem=true)
 
SpriteenableCollisions (int collisionType=collide_AlphaChannel)
 
SpritedisableCollisions ()
 
SpritesetCollisionRadius (float pixelRadius)
 
float getCollisionRadius ()
 
void useCollisionMask (Image *frameImage, Image *maskImage)
 
void setCollisionHelper (ISpriteCollideHelper *helper)
 
SpritesetElasticity (float elasticity)
 
float getElasticity ()
 
bool getWantsMouseOverEvents ()
 
bool getWantsClickEvents ()
 
int getMouseDetectMode ()
 
bool getWantsOffscreenEvents ()
 
SpritesetWantsMouseOverEvents (bool wantsThem=true)
 
SpritesetWantsClickEvents (bool wantsThem=true)
 
SpritesetMouseDetectMode (int collisionType=collide_BoundingBox)
 
SpritesetWantsOffscreenEvents (bool wantsThem=true)
 
void setUserData (UserData *userData)
 
void freeUserData ()
 
SpriteLayergetLayer ()
 
- Public Member Functions inherited from EventEmitter
virtual void addHandler (IEventHandler *inHandler, long inType=all_events)
 add a new handler for some event type, or for all events if no type specified
 
virtual void removeHandler (IEventHandler *inHandler, long inType=all_events)
 Remove a handler for some event type, or for all events if no type specified.
 
virtual void clear (bool doRelease=true)
 remove all handlers
 
virtual void blockEvent (long inEventType)
 temporarily ignore all events of a particular type, just drop them on the floor
 
virtual void unblockEvent (long inEventType)
 stop ignoring events of a particular type, no recovery of previously ignored events
 
 EventEmitter ()
 constructor for new event emitter
 
virtual bool postEvent (long inEventType, void *inEventData, EventEmitter *fromEmitter=0)
 post an event for immediate handling locally, or relay it to the EventManger
 
- Public Member Functions inherited from Animated
 SERIALIZABLE_TAG (CLASSTAG_ANIMATED)
 
 SERIALIZABLE_METHODS ()
 
Rect getBoundingBox ()
 
RotatedRect getRotatedBounds ()
 
AnimatedsetLocation (const Point &loc)
 
Point getLocation ()
 
AnimatedmoveTo (float x, float y)
 
AnimatedmoveTo (const Point &where)
 
Animatedmove (float deltaX, float deltaY)
 
Animatedmove (const Offset &delta)
 
virtual void moveTo (const Point &loc, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void moveTo (float x, float y, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void move (float deltaX, float deltaY, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void move (const Offset &delta, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
virtual AnimatedsetVelocity (const Vector &deltaPerSec)
 
virtual Vector getVelocity ()
 
AnimatedsetSpeed (float speed)
 
float getSpeed ()
 
AnimatedsetVelocityInRadians (float speed, float direction)
 
float getMovementDirectionInRadians ()
 
AnimatedsetVelocity (float deltaXPerSec, float deltaYPerSec)
 
AnimatedstopMoving ()
 
virtual void accelerateTo (float speed, ms_delta msDuration, EasingFunc easing=linearTween)
 
void accelerate (float deltaSpeed, ms_delta msDuration, EasingFunc easing=linearTween)
 
AnimatedsetSize (float width, float height)
 
AnimatedsetWidth (float width)
 
float getWidth ()
 
AnimatedsetHeight (float height)
 
float getHeight ()
 
Animatedgrow (float factor)
 
Animatedstretch (float widthFactor, float heightFactor)
 
AnimatedstartGrowing (float amountPerSecond)
 
AnimatedstopGrowing ()
 
AnimatedstartStretching (float widthPerSecond, float heightPerSecond)
 
AnimatedstopStretching ()
 
virtual void resizeTo (float width, float height, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void resize (float deltaWidth, float deltaHeight, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void grow (float factor, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void stretch (float widthFactor, float weightFactor, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
AnimatedsetRotation (float radiansRotation)
 
float getRotation ()
 
AnimatedsetCenterOffset (const Offset &offset)
 
Offset getCenterOffset ()
 
AnimatedrotateTo (float radiansRotation)
 
Animatedrotate (float radians)
 
AnimatedsetSpin (float radiansPerSecond)
 
float getSpin ()
 
AnimatedstopSpinning ()
 
virtual void rotateTo (float radiansRotation, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void rotate (float radians, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void changeCenterTo (float xOffset, float yOffset, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void changeCenterTo (const Offset &offset, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void changeCenter (float deltaXOffset, float deltaYOffset, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
void changeCenter (const Offset &offset, ms_delta msDuration, EasingFunc easing=easeInOutQuad)
 
Animatedwait (ms_delta msDuration)
 
virtual AnimatedsetMass (float mass)
 
float getMass ()
 
virtual AnimatedsetFriction (float frictionCoefficient)
 
AnimatedsetMoveFriction (float frictionCoefficient)
 
AnimatedsetSpinFriction (float frictionCoefficient)
 
AnimatedsetSizeFriction (float frictionCoefficient)
 
float getMoveFriction ()
 
float getSpinFriction ()
 
float getSizeFriction ()
 
virtual void applyForce (const Vector &force, ms_delta msDuration=duration_Instantaneous)
 
virtual void applyForce (float forceX, float forceY, ms_delta msDuration=duration_Instantaneous)
 
virtual void applyTorque (float forceSpin, ms_delta msDuration=duration_Instantaneous)
 
virtual void stopAllForces ()
 
virtual void addAnimationHelper (IAnimationHelper *helper)
 
virtual void removeAnimationHelper (IAnimationHelper *helper)
 
virtual void clearAnimationHelpers ()
 
- Public Member Functions inherited from ISerializable
virtual uint32 getSerializedSize (ISerializer *serializer) const =0
 Get number of bytes needed to hold serialized state.
 
virtual void serialize (ISerializer *serializer) const =0
 Write self out to a serializer.
 
virtual void deserialize (IDeserializer *deserializer)=0
 Read self from a deserializer.
 
virtual uint32 getMyClassTag () const =0
 Get a tag value that uniquely represents this class.
 
 ISerializable ()
 
virtual ~ISerializable ()
 
- Public Member Functions inherited from RefCountedObj
virtual void addRef () const throw ()
 
virtual void release () const throw ()
 

Static Public Member Functions

static pdg::ISerializableCreateInstance ()
 
- Static Public Member Functions inherited from Animated
static pdg::ISerializableCreateInstance ()
 

Public Attributes

long spriteId
 
bool wantsMouseOver
 
bool wantsClicks
 
bool wantsAnimLoop
 
bool wantsAnimEnd
 
bool wantsOffscreen
 
bool wantsWallCollide
 
UserDatauserData
 

Friends

class SpriteLayer
 
class TileLayer
 
class SpriteManager
 

Member Enumeration Documentation

anonymous enum
Enumerator:
animate_StartToEnd 
animate_EndToStart 
animate_Unidirectional 
animate_Bidirectional 
animate_NoLooping 
animate_Looping 
start_FromFirstFrame 
start_FromLastFrame 
all_Frames 
action_CollideSprite 
action_CollideWall 
action_Offscreen 
action_Onscreen 
action_ExitLayer 
action_AnimationLoop 
action_AnimationEnd 
action_FadeComplete 
action_FadeInComplete 
action_FadeOutComplete 
action_JointBreak 
touch_MouseEnter 
touch_MouseLeave 

NOT IMPLEMENTED

touch_MouseDown 

NOT IMPLEMENTED

touch_MouseUp 
touch_MouseClick 
collide_None 
collide_Point 
collide_BoundingBox 
collide_CollisionRadius 
collide_AlphaChannel 
collide_Last 

Member Function Documentation

void addFramesImage ( Image image,
int  startingFrame = start_FromFirstFrame,
int  numFrames = all_Frames 
)
void changeFramesImage ( Image oldImage,
Image newImage 
)
static pdg::ISerializable* CreateInstance ( )
inlinestatic
Sprite& disableCollisions ( )
Sprite& enableCollisions ( int  collisionType = collide_AlphaChannel)
void fadeIn ( ms_delta  msDuration,
EasingFunc  easing = linearTween 
)
void fadeOut ( ms_delta  msDuration,
EasingFunc  easing = linearTween 
)
void fadeTo ( float  targetOpacity,
ms_delta  msDuration,
EasingFunc  easing = linearTween 
)
void freeUserData ( )
float getCollisionRadius ( )
int getCurrentFrame ( )
float getElasticity ( )
Offset getFrameCenterOffset ( Image image = 0,
int  frameNum = 0 
)
int getFrameCount ( )
inline
RotatedRect getFrameRotatedBounds ( int  frameNum = -1)
SpriteLayer* getLayer ( )
inline
int getMouseDetectMode ( )
inline
float getOpacity ( )
bool getWantsAnimEndEvents ( )
inline
bool getWantsAnimLoopEvents ( )
inline
bool getWantsClickEvents ( )
inline
bool getWantsCollideWallEvents ( )
inline
bool getWantsMouseOverEvents ( )
inline
bool getWantsOffscreenEvents ( )
inline
int getZOrder ( )
bool isBehind ( Sprite sprite)
Sprite& moveBehind ( Sprite sprite)
Sprite& moveInFrontOf ( Sprite sprite)
Sprite & moveToBack ( )
inline
Sprite & moveToFront ( )
inline
void offsetFrameCenters ( int  offsetX,
int  offsetY,
Image image = 0,
int  startingFrame = start_FromFirstFrame,
int  numFrames = all_Frames 
)
SERIALIZABLE_METHODS ( )
SERIALIZABLE_TAG ( CLASSTAG_SPRITE  )
void setCollisionHelper ( ISpriteCollideHelper helper)
Sprite& setCollisionRadius ( float  pixelRadius)
void setDrawHelper ( ISpriteDrawHelper helper)
Sprite& setElasticity ( float  elasticity)
Sprite& setFrame ( int  frame)
Sprite& setMouseDetectMode ( int  collisionType = collide_BoundingBox)
Sprite& setOpacity ( float  opacity)
void setPostDrawHelper ( ISpriteDrawHelper helper)
void setUserData ( UserData userData)
Sprite & setWantsAnimEndEvents ( bool  wantsThem = true)
inline
Sprite & setWantsAnimLoopEvents ( bool  wantsThem = true)
inline
Sprite& setWantsClickEvents ( bool  wantsThem = true)
Sprite & setWantsCollideWallEvents ( bool  wantsThem = true)
inline
Sprite& setWantsMouseOverEvents ( bool  wantsThem = true)
Sprite & setWantsOffscreenEvents ( bool  wantsThem = true)
inline
void startFrameAnimation ( float  fps,
int  startingFrame = start_FromFirstFrame,
int  numFrames = all_Frames,
int  animateFlags = animate_Looping 
)
void stopFrameAnimation ( )
void useCollisionMask ( Image frameImage,
Image maskImage 
)

Friends And Related Function Documentation

friend class SpriteLayer
friend
friend class SpriteManager
friend
friend class TileLayer
friend

Member Data Documentation

long spriteId
UserData* userData
bool wantsAnimEnd
bool wantsAnimLoop
bool wantsClicks
bool wantsMouseOver
bool wantsOffscreen
bool wantsWallCollide