cocos2d-x  2.2.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCArmatureAnimation Class Reference

#include <CCArmatureAnimation.h>

Inheritance diagram for CCArmatureAnimation:
CCProcessBase CCObject CCCopying

Public Member Functions

 CCArmatureAnimation ()
virtual ~CCArmatureAnimation (void)
virtual bool init (CCArmature *armature)
 Init with a CCArmature. More...
 
virtual
CC_DEPRECATED_ATTRIBUTE void 
setAnimationScale (float animationScale)
 Scale animation play speed. More...
 
virtual
CC_DEPRECATED_ATTRIBUTE float 
getAnimationScale () const
virtual void setSpeedScale (float speedScale)
 Scale animation play speed. More...
 
virtual float getSpeedScale () const
virtual
CC_DEPRECATED_ATTRIBUTE void 
setAnimationInternal (float animationInternal)
 The animation update speed. More...
 
virtual void play (const char *animationName, int durationTo=-1, int durationTween=-1, int loop=-1, int tweenEasing=TWEEN_EASING_MAX)
 Play animation by animation name. More...
 
virtual
CC_DEPRECATED_ATTRIBUTE void 
playByIndex (int animationIndex, int durationTo=-1, int durationTween=-1, int loop=-1, int tweenEasing=TWEEN_EASING_MAX)
 Play animation by index, the other param is the same to play. More...
 
virtual void playWithIndex (int animationIndex, int durationTo=-1, int durationTween=-1, int loop=-1, int tweenEasing=TWEEN_EASING_MAX)
virtual void playWithNames (const std::vector< std::string > &movementNames, int durationTo=-1, bool loop=true)
 Play several animation by names. More...
 
virtual void playWithIndexes (const std::vector< int > &movementIndexes, int durationTo=-1, bool loop=true)
 Play several animation by indexes. More...
 
virtual void playWithArray (cocos2d::CCArray *movementNames, int durationTo=-1, bool loop=true)
virtual void playWithIndexArray (cocos2d::CCArray *movementIndexes, int durationTo=-1, bool loop=true)
virtual void gotoAndPlay (int frameIndex)
 Go to specified frame and play current movement. More...
 
virtual void gotoAndPause (int frameIndex)
 Go to specified frame and pause current movement. More...
 
virtual void pause ()
 Pause the Process. More...
 
virtual void resume ()
 Resume the Process. More...
 
virtual void stop ()
 Stop the Process. More...
 
int getMovementCount ()
 Get movement count. More...
 
void update (float dt)
 You should never call this function, unless you know what you do Update the Process, include current process, current frame and son on. More...
 
std::string getCurrentMovementID ()
 Get current movementID. More...
 
void setMovementEventCallFunc (CCObject *target, SEL_MovementEventCallFunc callFunc)
 Set armature's movement event callback function To disconnect this event, just setMovementEventCallFunc(NULL, NULL);. More...
 
void setFrameEventCallFunc (CCObject *target, SEL_FrameEventCallFunc callFunc)
 Set armature's frame event callback function To disconnect this event, just setFrameEventCallFunc(NULL, NULL);. More...
 
virtual CCObjectgetUserObject ()
 Returns a user assigned CCObject. More...
 
virtual void setUserObject (CCObject *pUserObject)
 Returns a user assigned CCObject. More...
 
virtual CCAnimationDatagetAnimationData (void)
 getAnimationData More...
 
virtual void setAnimationData (CCAnimationData *var)
 setAnimationData More...
 
- Public Member Functions inherited from CCProcessBase
 CCProcessBase (void)
 ~CCProcessBase (void)
virtual void play (int durationTo, int durationTween, int loop, int tweenEasing)
 Play animation by animation name. More...
 
virtual int getCurrentFrameIndex ()
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
void release (void)
void retain (void)
CCObjectautorelease (void)
CCObjectcopy (void)
bool isSingleReference (void) const
unsigned int retainCount (void) const
virtual bool isEqual (const CCObject *pObject)
virtual void acceptVisitor (CCDataVisitor &visitor)
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)

Static Public Member Functions

static CCArmatureAnimationcreate (CCArmature *armature)
 @ More...
 

Public Attributes

float m_fSpeedScale
 Scale the animation speed. More...
 
CCMovementDatam_pMovementData
CCArmaturem_pArmature
 CCMovementData save all MovementFrameDatas this animation used. More...
 
std::string m_strMovementID
 A weak reference of armature. More...
 
int m_iToIndex
 Current movment's name. More...
 
CCArraym_pTweenList
 The frame index in CCMovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex. More...
 
bool m_bIgnoreFrameEvent
std::queue< CCFrameEvent * > m_sFrameEventQueue
std::queue< CCMovementEvent * > m_sMovementEventQueue
std::vector< std::string > m_sMovementList
bool m_bOnMovementList
bool m_bMovementListLoop
unsigned int m_uMovementIndex
int m_iMovementListDurationTo
CCObjectm_pUserObject
- Public Attributes inherited from CCProcessBase
virtual float getProcessScale (void)\n\n public
 getProcessScale More...
 
virtual bool getIsPause (void)\n\n public
 getIsPause More...
 
virtual bool getIsComplete (void)\n\n public
 getIsComplete More...
 
virtual bool getIsPlaying (void)\n\n public
 getIsPlaying More...
 
virtual float getCurrentPercent (void)\n\n public
 getCurrentPercent More...
 
virtual int getRawDuration (void)\n\n public
 getRawDuration More...
 
virtual AnimationType getLoopType (void)\n\n public
 getLoopType More...
 
virtual CCTweenType getTweenEasing (void)\n\n public
 getTweenEasing More...
 
- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID

Protected Member Functions

void updateHandler ()
 Update(float dt) will call this handler, you can handle your logic here. More...
 
void updateFrameData (float currentPercent)
 Update current key frame, and process auto stop, pause. More...
 
void frameEvent (CCBone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex)
 Emit a frame event. More...
 
void movementEvent (CCArmature *armature, MovementEventType movementType, const char *movementID)
 Emit a movement event. More...
 
void updateMovementList ()
bool isIgnoreFrameEvent ()
- Protected Member Functions inherited from CCProcessBase
virtual void gotoFrame (int frameIndex)

Protected Attributes

CCAnimationDatam_pAnimationData
 CCAnimationData save all MovementDatas this animation used. More...
 
SEL_MovementEventCallFunc m_sMovementEventCallFunc
 MovementEvent CallFunc. More...
 
SEL_FrameEventCallFunc m_sFrameEventCallFunc
 FrameEvent CallFunc. More...
 
CCObjectm_sMovementEventTarget
CCObjectm_sFrameEventTarget
- Protected Attributes inherited from CCProcessBase
float m_fProcessScale
 Scale the process speed. More...
 
bool m_bIsPause
 Set and get whether the aniamtion is pause. More...
 
bool m_bIsComplete
 Set and get whether the aniamtion is complete. More...
 
bool m_bIsPlaying
 Set and get whether the aniamtion is playing. More...
 
float m_fCurrentPercent
 Current percent this process arrived. More...
 
int m_iRawDuration
 The raw duration. More...
 
AnimationType m_eLoopType
 The animation whether or not loop. More...
 
CCTweenType m_eTweenEasing
 The tween easing effect. More...
 
int m_iDurationTween
 The durantion frame count will run. More...
 
float m_fCurrentFrame
 Current frame this process arrived, this frame is tween frame. More...
 
int m_iCurFrameIndex
 Frame index it the time line. More...
 
int m_iNextFrameIndex
 Next frame this process need run to. More...
 
bool m_bIsLoopBack
float m_fAnimationInternal
 The animation update speed. More...
 
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Friends

class CCTween

Constructor & Destructor Documentation

virtual ~CCArmatureAnimation ( void  )
virtual

Member Function Documentation

static CCArmatureAnimation* create ( CCArmature armature)
static

@

void frameEvent ( CCBone bone,
const char *  frameEventName,
int  originFrameIndex,
int  currentFrameIndex 
)
protected

Emit a frame event.

virtual CCAnimationData*
getAnimationData
( void  )
virtual

getAnimationData

virtual
CC_DEPRECATED_ATTRIBUTE float
getAnimationScale
( ) const
virtual
std::string getCurrentMovementID ( )

Get current movementID.

Returns
The name of current movement
int getMovementCount ( )

Get movement count.

virtual float getSpeedScale ( ) const
virtual
virtual CCObject* getUserObject ( )
virtual

Returns a user assigned CCObject.

Returns
A user assigned CCObject
virtual void gotoAndPause ( int  frameIndex)
virtual

Go to specified frame and pause current movement.

virtual void gotoAndPlay ( int  frameIndex)
virtual

Go to specified frame and play current movement.

You need first switch to the movement you want to play, then call this function.

example : playByIndex(0); gotoAndPlay(0); playByIndex(1); gotoAndPlay(0); gotoAndPlay(15);

virtual bool init ( CCArmature armature)
virtual

Init with a CCArmature.

Parameters
armatureThe CCArmature CCArmatureAnimation will bind to
bool isIgnoreFrameEvent ( )
inlineprotected
void movementEvent ( CCArmature armature,
MovementEventType  movementType,
const char *  movementID 
)
protected

Emit a movement event.

virtual void pause ( )
virtual

Pause the Process.

Reimplemented from CCProcessBase.

virtual void play ( const char *  animationName,
int  durationTo = -1,
int  durationTween = -1,
int  loop = -1,
int  tweenEasing = TWEEN_EASING_MAX 
)
virtual

Play animation by animation name.

Parameters
animationNameThe animation name you want to play
durationToThe frames between two animation changing-over. It's meaning is changing to this animation need how many frames

-1 : use the value from CCMovementData get from flash design panel

Parameters
durationTweenThe frame count you want to play in the game. if _durationTween is 80, then the animation will played 80 frames in a loop

-1 : use the value from CCMovementData get from flash design panel

Parameters
loopWhether the animation is loop
    loop < 0 : use the value from CCMovementData get from flash design panel
    loop = 0 : this animation is not loop
    loop > 0 : this animation is loop
tweenEasingCCTween easing is used for calculate easing effect
    TWEEN_EASING_MAX : use the value from CCMovementData get from flash design panel
    -1 : fade out
    0  : line
    1  : fade in
    2  : fade in and out
virtual
CC_DEPRECATED_ATTRIBUTE void
playByIndex
( int  animationIndex,
int  durationTo = -1,
int  durationTween = -1,
int  loop = -1,
int  tweenEasing = TWEEN_EASING_MAX 
)
virtual

Play animation by index, the other param is the same to play.

Deprecated, please use playWithIndex

Parameters
animationIndexthe animation index you want to play
virtual void playWithArray ( cocos2d::CCArray movementNames,
int  durationTo = -1,
bool  loop = true 
)
virtual
virtual void playWithIndex ( int  animationIndex,
int  durationTo = -1,
int  durationTween = -1,
int  loop = -1,
int  tweenEasing = TWEEN_EASING_MAX 
)
virtual
virtual void playWithIndexArray ( cocos2d::CCArray movementIndexes,
int  durationTo = -1,
bool  loop = true 
)
virtual
virtual void playWithIndexes ( const std::vector< int > &  movementIndexes,
int  durationTo = -1,
bool  loop = true 
)
virtual

Play several animation by indexes.

virtual void playWithNames ( const std::vector< std::string > &  movementNames,
int  durationTo = -1,
bool  loop = true 
)
virtual

Play several animation by names.

virtual void resume ( )
virtual

Resume the Process.

Reimplemented from CCProcessBase.

virtual void setAnimationData ( CCAnimationData var)
virtual

setAnimationData

virtual
CC_DEPRECATED_ATTRIBUTE void
setAnimationInternal
( float  animationInternal)
inlinevirtual

The animation update speed.

virtual
CC_DEPRECATED_ATTRIBUTE void
setAnimationScale
( float  animationScale)
virtual

Scale animation play speed.

This method is deprecated, please use setSpeedScale.

Parameters
animationScaleScale value
void setFrameEventCallFunc ( CCObject target,
SEL_FrameEventCallFunc  callFunc 
)

Set armature's frame event callback function To disconnect this event, just setFrameEventCallFunc(NULL, NULL);.

void setMovementEventCallFunc ( CCObject target,
SEL_MovementEventCallFunc  callFunc 
)

Set armature's movement event callback function To disconnect this event, just setMovementEventCallFunc(NULL, NULL);.

virtual void setSpeedScale ( float  speedScale)
virtual

Scale animation play speed.

Parameters
animationScaleScale value
virtual void setUserObject ( CCObject pUserObject)
virtual

Returns a user assigned CCObject.

The UserObject will be retained once in this method, and the previous UserObject (if existed) will be relese. The UserObject will be released in destructure.

Parameters
Auser assigned CCObject
virtual void stop ( )
virtual

Stop the Process.

Reimplemented from CCProcessBase.

void update ( float  dt)
virtual

You should never call this function, unless you know what you do Update the Process, include current process, current frame and son on.

Parameters
Theduration since last update

Reimplemented from CCProcessBase.

void updateFrameData ( float  currentPercent)
protected

Update current key frame, and process auto stop, pause.

void updateHandler ( )
protectedvirtual

Update(float dt) will call this handler, you can handle your logic here.

Reimplemented from CCProcessBase.

void updateMovementList ( )
protected

Friends And Related Function Documentation

friend class CCTween
friend

Member Data Documentation

bool m_bIgnoreFrameEvent
bool m_bMovementListLoop
bool m_bOnMovementList
float m_fSpeedScale

Scale the animation speed.

int m_iMovementListDurationTo
int m_iToIndex

Current movment's name.

CCAnimationData* m_pAnimationData
protected

CCAnimationData save all MovementDatas this animation used.

CCArmature* m_pArmature

CCMovementData save all MovementFrameDatas this animation used.

CCMovementData* m_pMovementData
CCArray* m_pTweenList

The frame index in CCMovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex.

CCObject* m_pUserObject
SEL_FrameEventCallFunc
m_sFrameEventCallFunc
protected

FrameEvent CallFunc.

Parameters
CCBone*,aCCBone
constchar*, the name of this frame event
int,originframe index
int,currentframe index, animation may be delayed
std::queue<CCFrameEvent*>
m_sFrameEventQueue
CCObject* m_sFrameEventTarget
protected
SEL_MovementEventCallFunc
m_sMovementEventCallFunc
protected

MovementEvent CallFunc.

Parameters
CCArmature*a CCArmature
MovementEventType,EventType, like START, COMPLETE.
constchar*, Movement ID, also called Movement Name
std::queue<CCMovementEvent*>
m_sMovementEventQueue
CCObject* m_sMovementEventTarget
protected
std::vector<std::string>
m_sMovementList
std::string m_strMovementID

A weak reference of armature.

unsigned int m_uMovementIndex

The documentation for this class was generated from the following file: