CCObject

#ifndef __CCOBJECT_H__

#define __CCOBJECT_H__


#include "CCDataVisitor.h"


#ifdef EMSCRIPTEN

#include <GLES2/gl2.h>

#endif // EMSCRIPTEN


NS_CC_BEGIN


/**

 * @addtogroup base_nodes

 * @{

 */


class CCZone;

class CCObject;

class CCNode;

class CCEvent;


class CC_DLL CCCopying

{

public:

    virtual CCObject* copyWithZone(CCZone* pZone);

};


class CC_DLL CCObject : public CCCopying

{

public:

    // object id, CCScriptSupport need public m_uID

    unsigned int        m_uID;

    // Lua reference id

    int                 m_nLuaID;

protected:

    // count of references

    unsigned int        m_uReference;

    // count of autorelease

    unsigned int        m_uAutoReleaseCount;

public:

    CCObject(void);

    virtual ~CCObject(void);

    

    void release(void);

    void retain(void);

    CCObject* autorelease(void);

    CCObject* copy(void);

    bool isSingleReference(void) const;

    unsigned int retainCount(void) const;

    virtual bool isEqual(const CCObject* pObject);


    virtual void acceptVisitor(CCDataVisitor &visitor);


    virtual void update(float dt) {CC_UNUSED_PARAM(dt);};

    

    friend class CCAutoreleasePool;

};



typedef void (CCObject::*SEL_SCHEDULE)(float);

typedef void (CCObject::*SEL_CallFunc)();

typedef void (CCObject::*SEL_CallFuncN)(CCNode*);

typedef void (CCObject::*SEL_CallFuncND)(CCNode*, void*);

typedef void (CCObject::*SEL_CallFuncO)(CCObject*);

typedef void (CCObject::*SEL_MenuHandler)(CCObject*);

typedef void (CCObject::*SEL_EventHandler)(CCEvent*);

typedef int (CCObject::*SEL_Compare)(CCObject*);


#define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(&_SELECTOR)

#define callfunc_selector(_SELECTOR) (SEL_CallFunc)(&_SELECTOR)

#define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(&_SELECTOR)

#define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(&_SELECTOR)

#define callfuncO_selector(_SELECTOR) (SEL_CallFuncO)(&_SELECTOR)

#define menu_selector(_SELECTOR) (SEL_MenuHandler)(&_SELECTOR)

#define event_selector(_SELECTOR) (SEL_EventHandler)(&_SELECTOR)

#define compare_selector(_SELECTOR) (SEL_Compare)(&_SELECTOR)


// end of base_nodes group

/// @}


NS_CC_END


#endif // __CCOBJECT_H__


转载于:https://www.cnblogs.com/sssssnian/p/3748603.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值