mirror of https://github.com/axmolengine/axmol.git
155 lines
3.7 KiB
Plaintext
155 lines
3.7 KiB
Plaintext
|
|
#include "CCAction.h"
|
|
#include "selector_protocol.h"
|
|
|
|
namespace cocos2d {
|
|
|
|
|
|
class CCActionInstant : public CCFiniteTimeAction //<NSCopying>
|
|
{
|
|
public:
|
|
CCActionInstant();
|
|
|
|
|
|
CCObject* copyWithZone(CCZone *pZone);
|
|
bool isDone(void);
|
|
void step(ccTime dt);
|
|
void update(ccTime time);
|
|
CCFiniteTimeAction * reverse(void);
|
|
};
|
|
|
|
|
|
class CCShow : public CCActionInstant
|
|
{
|
|
|
|
CCShow(){}
|
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
virtual CCFiniteTimeAction * reverse(void);
|
|
static CCShow * action();
|
|
};
|
|
|
|
|
|
class CCHide : public CCActionInstant
|
|
{
|
|
|
|
CCHide(){}
|
|
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
virtual CCFiniteTimeAction * reverse(void);
|
|
static CCHide * action();
|
|
};
|
|
|
|
|
|
class CCToggleVisibility : public CCActionInstant
|
|
{
|
|
|
|
CCToggleVisibility();
|
|
virtual void startWithTarget(CCNode *pTarget);
|
|
static CCToggleVisibility * action();
|
|
};
|
|
|
|
class CCFlipX : public CCActionInstant
|
|
{
|
|
|
|
CCFlipX();
|
|
|
|
static CCFlipX * actionWithFlipX(bool x);
|
|
|
|
bool initWithFlipX(bool x);
|
|
|
|
void startWithTarget(CCNode *pTarget);
|
|
CCFiniteTimeAction * reverse(void);
|
|
CCObject* copyWithZone(CCZone *pZone);
|
|
|
|
|
|
};
|
|
|
|
class CCFlipY : public CCActionInstant
|
|
{
|
|
public:
|
|
CCFlipY();
|
|
static CCFlipY * actionWithFlipY(bool y);
|
|
bool initWithFlipY(bool y);
|
|
void startWithTarget(CCNode *pTarget);
|
|
CCFiniteTimeAction * reverse(void);
|
|
CCObject* copyWithZone(CCZone *pZone);
|
|
};
|
|
|
|
|
|
class CCPlace : public CCActionInstant //<NSCopying>
|
|
{
|
|
CCPlace();
|
|
static CCPlace * actionWithPosition(CCPoint pos);
|
|
bool initWithPosition(CCPoint pos);
|
|
void startWithTarget(CCNode *pTarget);
|
|
CCObject* copyWithZone(CCZone *pZone);
|
|
};
|
|
|
|
/** @brief Calls a 'callback'
|
|
*/
|
|
class CCCallFunc : public CCActionInstant //<NSCopying>
|
|
{
|
|
CCCallFunc();
|
|
static CCCallFunc * actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFunc selector);
|
|
static CCCallFunc* actionWithScriptFuncName(const char* pszFuncName);
|
|
bool initWithTarget(SelectorProtocol* pSelectorTarget);
|
|
bool initWithScriptFuncName(const char* pszFuncName);
|
|
void execute();
|
|
void startWithTarget(CCNode *pTarget);
|
|
CCObject * copyWithZone(cocos2d::CCZone *pZone);
|
|
|
|
SelectorProtocol* getTargetCallback();
|
|
void setTargetCallback(SelectorProtocol* pSel);
|
|
};
|
|
|
|
|
|
class CCCallFuncN : public CCCallFunc
|
|
{
|
|
CCCallFuncN();
|
|
static CCCallFuncN * actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncN selector);
|
|
static CCCallFuncN* actionWithScriptFuncName(const char* pszFuncName);
|
|
bool initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncN selector);
|
|
CCObject* copyWithZone(CCZone *pZone);
|
|
void execute();
|
|
};
|
|
|
|
|
|
|
|
class CCCallFuncND : public CCCallFuncN
|
|
{
|
|
|
|
/** creates the action with the callback and the data to pass as an argument */
|
|
static CCCallFuncND * actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncND selector, void* d);
|
|
static CCCallFuncND* actionWithScriptFuncName(const char* pszFuncName, void *d);
|
|
/** initializes the action with the callback and the data to pass as an argument */
|
|
virtual bool initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncND selector, void* d);
|
|
// super methods
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
virtual void execute();
|
|
|
|
};
|
|
|
|
|
|
|
|
class CCCallFuncO : public CCCallFunc
|
|
{
|
|
|
|
CCCallFuncO();
|
|
|
|
static CCCallFuncO * actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
|
|
static CCCallFuncO* actionWithScriptFuncName(const char* pszFuncName);
|
|
|
|
bool initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
|
|
|
|
CCObject* copyWithZone(CCZone *pZone);
|
|
void execute();
|
|
|
|
CCObject* getObject();
|
|
void setObject(CCObject* pObj);
|
|
|
|
};
|
|
|
|
}
|
|
|