cocos2d-x  2.2.1
 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 void setAnimationInternal (float animationInternal)
 The animation update speed. More...
 
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...
 
var play ( var animationName, var 1, var 1, var 1, var TWEEN_EASING_MAX)
 Play animation by animation name. More...
 
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 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...
 
var resume ()
 Resume the Process. More...
 
virtual void stop ()
 Stop the Process. More...
 
var stop ()
 Stop the Process. More...
 
int getMovementCount ()
 Get movement count. More...
 
var 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...
 
var 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...
 
var setMovementEventCallFunc ( var target, var 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...
 
var create ( var armature)
 @ More...
 

Public Attributes

float m_fSpeedScale
 Scale the animation speed. More...
 
var m_fSpeedScale
 Scale the animation speed. More...
 
CCMovementDatam_pMovementData
CCArmaturem_pArmature
 CCMovementData save all MovementFrameDatas this animation used. More...
 
var m_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...
 
var m_pTweenList
 The frame index in CCMovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex. More...
 
bool m_bIgnoreFrameEvent
var m_bIgnoreFrameEvent
std::queue< CCFrameEvent * > m_sFrameEventQueue
var m_sFrameEventQueue
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...
 
virtual float getAnimationInternal (void)\n\n public
 getAnimationInternal 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...
 
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...
 
var m_pAnimationData
 CCAnimationData save all MovementDatas this animation used. More...
 
SEL_MovementEventCallFunc m_sMovementEventCallFunc
 MovementEvent CallFunc. More...
 
var 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...
 
float m_fAnimationInternal
 The animation update speed. 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
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Friends

class CCTween

Constructor & Destructor Documentation

var ctor ( )
virtual ~CCArmatureAnimation ( void  )
virtual

Member Function Documentation

static CCArmatureAnimation* create ( CCArmature armature)
static

@

var create ( var  armature)
static

@

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

Emit a frame event.

virtual CCAnimationData*
getAnimationData
( void  )
virtual

getAnimationData

var getAnimationData (   )
virtual

getAnimationData

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

Get current movementID.

Returns
The name of current movement
var getCurrentMovementID ( )

Get current movementID.

Returns
The name of current movement
int getMovementCount ( )

Get movement count.

var getMovementCount ( )

Get movement count.

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

Returns a user assigned CCObject.

Returns
A user assigned CCObject
var 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.

var gotoAndPause ( var  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);

var gotoAndPlay ( var  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
var init ( var  armature)
virtual

Init with a CCArmature.

Parameters
armatureThe CCArmature CCArmatureAnimation will bind to
bool isIgnoreFrameEvent ( )
inlineprotected
var isIgnoreFrameEvent ( )
inlineprotected
virtual void pause ( )
virtual

Pause the Process.

Reimplemented from CCProcessBase.

var pause ( )
virtual

Pause the Process.

Reimplemented from CCProcessBase.

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

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
var play ( var  animationName,
var  durationTo = -1,
var  durationTween = -1,
var  loop = -1,
var  tweenEasing = TWEEN_EASING_MAX 
)

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
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.

Parameters
animationIndexthe animation index you want to play
var playByIndex ( var  animationIndex,
var  durationTo = -1,
var  durationTween = -1,
var  loop = -1,
var  tweenEasing = TWEEN_EASING_MAX 
)

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

Parameters
animationIndexthe animation index you want to play
virtual void resume ( )
virtual

Resume the Process.

Reimplemented from CCProcessBase.

var resume ( )
virtual

Resume the Process.

Reimplemented from CCProcessBase.

virtual void setAnimationData ( CCAnimationData var)
virtual

setAnimationData

var setAnimationData ( var  var)
virtual

setAnimationData

virtual void setAnimationInternal ( float  animationInternal)
virtual

The animation update speed.

var setAnimationInternal ( var  animationInternal)
virtual

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
var setAnimationScale ( var  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);.

var setFrameEventCallFunc ( var  target,
var  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);.

var setMovementEventCallFunc ( var  target,
var  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
var setSpeedScale ( var  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
var setUserObject ( var  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.

var 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.

var update ( var  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.

Friends And Related Function Documentation

friend class CCTween
friend

Member Data Documentation

bool m_bIgnoreFrameEvent
var m_bIgnoreFrameEvent
float m_fSpeedScale

Scale the animation speed.

var m_fSpeedScale

Scale the animation speed.

int m_iToIndex

Current movment's name.

var m_iToIndex

Current movment's name.

CCAnimationData* m_pAnimationData
protected

CCAnimationData save all MovementDatas this animation used.

var m_pAnimationData
protected

CCAnimationData save all MovementDatas this animation used.

CCArmature* m_pArmature

CCMovementData save all MovementFrameDatas this animation used.

var m_pArmature

CCMovementData save all MovementFrameDatas this animation used.

CCMovementData* m_pMovementData
var m_pMovementData
CCArray* m_pTweenList

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

var m_pTweenList

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

CCObject* m_pUserObject
var 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
var 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
var m_sFrameEventQueue
CCObject* m_sFrameEventTarget
protected
var 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
var m_sMovementEventCallFunc
protected

MovementEvent CallFunc.

Parameters
CCArmature*a CCArmature
MovementEventType,EventType, like START, COMPLETE.
constchar*, Movement ID, also called Movement Name
CCObject* m_sMovementEventTarget
protected
var m_sMovementEventTarget
protected
std::string m_strMovementID

A weak reference of armature.

var m_strMovementID

A weak reference of armature.


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