2010-11-12 17:26:01 +08:00
|
|
|
/****************************************************************************
|
2012-06-14 17:18:05 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2011-03-19 10:59:01 +08:00
|
|
|
Copyright (c) 2008-2010 Ricardo Quesada
|
2011-07-01 15:08:23 +08:00
|
|
|
Copyright (c) 2011 Zynga Inc.
|
2010-11-12 17:26:01 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CCINSTANT_ACTION_H__
|
|
|
|
#define __CCINSTANT_ACTION_H__
|
|
|
|
|
2011-06-21 10:18:43 +08:00
|
|
|
#include <string>
|
2012-08-28 12:04:51 +08:00
|
|
|
#include "ccTypeInfo.h"
|
2010-11-12 17:26:01 +08:00
|
|
|
#include "CCAction.h"
|
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup actions
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
/**
|
|
|
|
@brief Instant actions are immediate actions. They don't have a duration like
|
|
|
|
the CCIntervalAction actions.
|
|
|
|
*/
|
|
|
|
class CC_DLL CCActionInstant : public CCFiniteTimeAction //<NSCopying>
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCActionInstant();
|
|
|
|
virtual ~CCActionInstant(){}
|
|
|
|
// CCAction methods
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
|
|
virtual bool isDone(void);
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void step(float dt);
|
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
//CCFiniteTimeAction method
|
|
|
|
virtual CCFiniteTimeAction * reverse(void);
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief Show the node
|
|
|
|
*/
|
|
|
|
class CC_DLL CCShow : public CCActionInstant
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCShow(){}
|
|
|
|
virtual ~CCShow(){}
|
|
|
|
//super methods
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCFiniteTimeAction * reverse(void);
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
2012-04-18 18:43:45 +08:00
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
//override static method
|
2012-06-14 15:13:16 +08:00
|
|
|
/** Allocates and initializes the action
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCShow * action();
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Allocates and initializes the action */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCShow * create();
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Hide the node
|
|
|
|
*/
|
|
|
|
class CC_DLL CCHide : public CCActionInstant
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCHide(){}
|
|
|
|
virtual ~CCHide(){}
|
|
|
|
//super methods
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCFiniteTimeAction * reverse(void);
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
2012-04-18 18:43:45 +08:00
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
//override static method
|
2012-06-14 15:13:16 +08:00
|
|
|
/** Allocates and initializes the action
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCHide * action();
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Allocates and initializes the action */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCHide * create();
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief Toggles the visibility of a node
|
|
|
|
*/
|
|
|
|
class CC_DLL CCToggleVisibility : public CCActionInstant
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCToggleVisibility(){}
|
|
|
|
virtual ~CCToggleVisibility(){}
|
|
|
|
//super method
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-05-30 16:34:42 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
2012-04-18 18:43:45 +08:00
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
//override static method
|
2012-06-14 15:13:16 +08:00
|
|
|
/** Allocates and initializes the action
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCToggleVisibility * action();
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Allocates and initializes the action */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCToggleVisibility * create();
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Flips the sprite horizontally
|
|
|
|
@since v0.99.0
|
|
|
|
*/
|
|
|
|
class CC_DLL CCFlipX : public CCActionInstant
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCFlipX()
|
|
|
|
:m_bFlipX(false)
|
|
|
|
{}
|
|
|
|
virtual ~CCFlipX(){}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
/** create the action
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCFlipX * actionWithFlipX(bool x);
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** create the action */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFlipX * create(bool x);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** init the action */
|
|
|
|
bool initWithFlipX(bool x);
|
|
|
|
//super methods
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCFiniteTimeAction * reverse(void);
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
2012-04-18 18:43:45 +08:00
|
|
|
|
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
bool m_bFlipX;
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Flips the sprite vertically
|
|
|
|
@since v0.99.0
|
|
|
|
*/
|
|
|
|
class CC_DLL CCFlipY : public CCActionInstant
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCFlipY()
|
|
|
|
:m_bFlipY(false)
|
|
|
|
{}
|
|
|
|
virtual ~CCFlipY(){}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
/** create the action
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCFlipY * actionWithFlipY(bool y);
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** create the action */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCFlipY * create(bool y);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** init the action */
|
|
|
|
bool initWithFlipY(bool y);
|
|
|
|
//super methods
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCFiniteTimeAction * reverse(void);
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
2012-04-18 18:43:45 +08:00
|
|
|
|
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
bool m_bFlipY;
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief Places the node in a certain position
|
|
|
|
*/
|
|
|
|
class CC_DLL CCPlace : public CCActionInstant //<NSCopying>
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCPlace(){}
|
|
|
|
virtual ~CCPlace(){}
|
2012-06-14 15:13:16 +08:00
|
|
|
/** creates a Place action with a position
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCPlace * actionWithPosition(const CCPoint& pos);
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates a Place action with a position */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCPlace * create(const CCPoint& pos);
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Initializes a Place action with a position */
|
|
|
|
bool initWithPosition(const CCPoint& pos);
|
|
|
|
//super methods
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
2012-04-18 18:43:45 +08:00
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCPoint m_tPosition;
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief Calls a 'callback'
|
|
|
|
*/
|
|
|
|
class CC_DLL CCCallFunc : public CCActionInstant //<NSCopying>
|
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCCallFunc()
|
2012-04-18 18:43:45 +08:00
|
|
|
: m_pSelectorTarget(NULL)
|
|
|
|
, m_pCallFunc(NULL)
|
2012-08-21 18:42:35 +08:00
|
|
|
, m_nScriptHandler(0)
|
2012-04-18 18:43:45 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
virtual ~CCCallFunc()
|
|
|
|
{
|
2012-06-15 15:10:40 +08:00
|
|
|
CC_SAFE_RELEASE(m_pSelectorTarget);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
2012-06-14 15:13:16 +08:00
|
|
|
/** creates the action with the callback
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
typedef void (CCObject::*SEL_CallFunc)();
|
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCCallFunc * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFunc selector);
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates the action with the callback
|
|
|
|
|
|
|
|
typedef void (CCObject::*SEL_CallFunc)();
|
|
|
|
*/
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCCallFunc * create(CCObject* pSelectorTarget, SEL_CallFunc selector);
|
|
|
|
|
2012-08-22 14:21:48 +08:00
|
|
|
/** creates the action with the handler script function */
|
2012-08-21 18:42:35 +08:00
|
|
|
static CCCallFunc * create(int nHandler);
|
|
|
|
|
|
|
|
/** initializes the action with the callback
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
typedef void (CCObject::*SEL_CallFunc)();
|
|
|
|
*/
|
|
|
|
virtual bool initWithTarget(CCObject* pSelectorTarget);
|
|
|
|
/** executes the callback */
|
|
|
|
virtual void execute();
|
|
|
|
//super methods
|
2012-06-08 13:55:28 +08:00
|
|
|
virtual void update(float time);
|
2012-04-19 14:35:52 +08:00
|
|
|
CCObject * copyWithZone(CCZone *pZone);
|
|
|
|
|
|
|
|
inline CCObject* getTargetCallback()
|
|
|
|
{
|
|
|
|
return m_pSelectorTarget;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void setTargetCallback(CCObject* pSel)
|
|
|
|
{
|
|
|
|
if (pSel != m_pSelectorTarget)
|
|
|
|
{
|
2012-06-15 15:10:40 +08:00
|
|
|
CC_SAFE_RETAIN(pSel);
|
|
|
|
CC_SAFE_RELEASE(m_pSelectorTarget);
|
|
|
|
m_pSelectorTarget = pSel;
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
}
|
2011-07-01 15:08:23 +08:00
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
/** Target that will be called */
|
|
|
|
CCObject* m_pSelectorTarget;
|
|
|
|
|
2012-08-21 18:42:35 +08:00
|
|
|
int m_nScriptHandler;
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
union
|
|
|
|
{
|
|
|
|
SEL_CallFunc m_pCallFunc;
|
|
|
|
SEL_CallFuncN m_pCallFuncN;
|
|
|
|
SEL_CallFuncND m_pCallFuncND;
|
2012-04-18 18:43:45 +08:00
|
|
|
SEL_CallFuncO m_pCallFuncO;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Calls a 'callback' with the node as the first argument
|
|
|
|
N means Node
|
|
|
|
*/
|
2012-07-28 02:01:02 +08:00
|
|
|
class CC_DLL CCCallFuncN : public CCCallFunc, public TypeInfo
|
2012-04-18 18:43:45 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-04-19 14:35:52 +08:00
|
|
|
CCCallFuncN(){}
|
|
|
|
virtual ~CCCallFuncN(){}
|
2012-08-08 04:54:34 +08:00
|
|
|
virtual long getClassTypeInfo() {
|
2012-08-29 14:52:30 +08:00
|
|
|
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::CCCallFunc).name());
|
|
|
|
return id;
|
2012-07-28 02:01:02 +08:00
|
|
|
}
|
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
/** creates the action with the callback
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
|
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCCallFuncN * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector);
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates the action with the callback
|
|
|
|
|
|
|
|
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
|
|
|
|
*/
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCCallFuncN * create(CCObject* pSelectorTarget, SEL_CallFuncN selector);
|
2012-08-21 18:42:35 +08:00
|
|
|
|
2012-08-22 14:21:48 +08:00
|
|
|
/** creates the action with the handler script function */
|
2012-08-21 18:42:35 +08:00
|
|
|
static CCCallFuncN * create(int nHandler);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** initializes the action with the callback
|
|
|
|
|
|
|
|
typedef void (CCObject::*SEL_CallFuncN)(CCNode*);
|
|
|
|
*/
|
|
|
|
virtual bool initWithTarget(CCObject* pSelectorTarget, SEL_CallFuncN selector);
|
|
|
|
// super methods
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
|
|
virtual void execute();
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Calls a 'callback' with the node as the first argument and the 2nd argument is data
|
|
|
|
* ND means: Node and Data. Data is void *, so it could be anything.
|
|
|
|
*/
|
2012-08-29 14:52:30 +08:00
|
|
|
class CC_DLL CCCallFuncND : public CCCallFuncN
|
2012-04-18 18:43:45 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-08-08 04:54:34 +08:00
|
|
|
virtual long getClassTypeInfo() {
|
2012-08-29 14:52:30 +08:00
|
|
|
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::CCCallFunc).name());
|
|
|
|
return id;
|
2012-07-28 02:01:02 +08:00
|
|
|
}
|
2012-04-18 18:43:45 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
/** creates the action with the callback and the data to pass as an argument
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCCallFuncND * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** creates the action with the callback and the data to pass as an argument */
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCCallFuncND * create(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
/** initializes the action with the callback and the data to pass as an argument */
|
|
|
|
virtual bool initWithTarget(CCObject* pSelectorTarget, SEL_CallFuncND selector, void* d);
|
|
|
|
// super methods
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
|
|
virtual void execute();
|
2012-04-18 18:43:45 +08:00
|
|
|
|
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
void *m_pData;
|
2012-04-18 18:43:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Calls a 'callback' with an object as the first argument.
|
|
|
|
O means Object.
|
|
|
|
@since v0.99.5
|
|
|
|
*/
|
2012-08-31 21:23:23 +08:00
|
|
|
|
2012-07-28 02:01:02 +08:00
|
|
|
class CC_DLL CCCallFuncO : public CCCallFunc, public TypeInfo
|
2012-04-18 18:43:45 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CCCallFuncO();
|
|
|
|
virtual ~CCCallFuncO();
|
2012-08-31 21:23:23 +08:00
|
|
|
|
2012-08-08 04:54:34 +08:00
|
|
|
virtual long getClassTypeInfo() {
|
2012-08-29 14:52:30 +08:00
|
|
|
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::CCCallFunc).name());
|
|
|
|
return id;
|
2012-07-28 02:01:02 +08:00
|
|
|
}
|
2012-08-31 21:23:23 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
/** creates the action with the callback
|
2012-06-20 14:31:36 +08:00
|
|
|
@deprecated: This interface will be deprecated sooner or later.
|
2012-06-14 15:13:16 +08:00
|
|
|
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);
|
|
|
|
*/
|
2012-06-20 11:48:31 +08:00
|
|
|
CC_DEPRECATED_ATTRIBUTE static CCCallFuncO * actionWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
|
2012-06-14 15:13:16 +08:00
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
/** creates the action with the callback
|
|
|
|
|
|
|
|
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);
|
|
|
|
*/
|
2012-06-14 15:13:16 +08:00
|
|
|
static CCCallFuncO * create(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
|
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
/** initializes the action with the callback
|
2011-03-19 10:59:01 +08:00
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
typedef void (CCObject::*SEL_CallFuncO)(CCObject*);
|
2011-03-19 10:59:01 +08:00
|
|
|
*/
|
2012-04-18 18:43:45 +08:00
|
|
|
virtual bool initWithTarget(CCObject* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject);
|
|
|
|
// super methods
|
|
|
|
virtual CCObject* copyWithZone(CCZone *pZone);
|
|
|
|
virtual void execute();
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
inline CCObject* getObject()
|
|
|
|
{
|
|
|
|
return m_pObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void setObject(CCObject* pObj)
|
|
|
|
{
|
|
|
|
if (pObj != m_pObject)
|
|
|
|
{
|
|
|
|
CC_SAFE_RELEASE(m_pObject);
|
|
|
|
m_pObject = pObj;
|
|
|
|
CC_SAFE_RETAIN(m_pObject);
|
|
|
|
}
|
|
|
|
}
|
2011-07-01 15:08:23 +08:00
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
protected:
|
2012-04-19 14:35:52 +08:00
|
|
|
/** object to be passed as argument */
|
2012-04-18 18:43:45 +08:00
|
|
|
CCObject* m_pObject;
|
|
|
|
};
|
2010-12-23 16:47:29 +08:00
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of actions group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-18 18:43:45 +08:00
|
|
|
NS_CC_END
|
2010-08-05 17:22:47 +08:00
|
|
|
|
2010-11-12 17:26:01 +08:00
|
|
|
#endif //__CCINSTANT_ACTION_H__
|