cocos2dx之一些宏的作用
来源:互联网 发布:美剧网络犯罪调查 编辑:程序博客网 时间:2024/04/24 16:06
/** CC_PROPERTY_READONLY is used to declare a protected variable. We can use getter to read the variable. @param varType : the type of variable. @param varName : variable name. @param funName : "get + funName" is the name of the getter. @warning : The getter is a public virtual function, you should rewrite it first. The variables and methods declared after CC_PROPERTY_READONLY are all public. If you need protected or private, please declare. */#define CC_PROPERTY_READONLY(varType, varName, funName)\protected: varType varName;\public: virtual varType get##funName(void);#define CC_PROPERTY_READONLY_PASS_BY_REF(varType, varName, funName)\protected: varType varName;\public: virtual const varType& get##funName(void);/** CC_PROPERTY is used to declare a protected variable. We can use getter to read the variable, and use the setter to change the variable. @param varType : the type of variable. @param varName : variable name. @param funName : "get + funName" is the name of the getter. "set + funName" is the name of the setter. @warning : The getter and setter are public virtual functions, you should rewrite them first. The variables and methods declared after CC_PROPERTY are all public. If you need protected or private, please declare. */#define CC_PROPERTY(varType, varName, funName)\protected: varType varName;\public: virtual varType get##funName(void);\public: virtual void set##funName(varType var);#define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\protected: varType varName;\public: virtual const varType& get##funName(void);\public: virtual void set##funName(const varType& var);/** CC_SYNTHESIZE_READONLY is used to declare a protected variable. We can use getter to read the variable. @param varType : the type of variable. @param varName : variable name. @param funName : "get + funName" is the name of the getter. @warning : The getter is a public inline function. The variables and methods declared after CC_SYNTHESIZE_READONLY are all public. If you need protected or private, please declare. */#define CC_SYNTHESIZE_READONLY(varType, varName, funName)\protected: varType varName;\public: virtual varType get##funName(void) const { return varName; }#define CC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName)\protected: varType varName;\public: virtual const varType& get##funName(void) const { return varName; }/** CC_SYNTHESIZE is used to declare a protected variable. We can use getter to read the variable, and use the setter to change the variable. @param varType : the type of variable. @param varName : variable name. @param funName : "get + funName" is the name of the getter. "set + funName" is the name of the setter. @warning : The getter and setter are public inline functions. The variables and methods declared after CC_SYNTHESIZE are all public. If you need protected or private, please declare. */#define CC_SYNTHESIZE(varType, varName, funName)\protected: varType varName;\public: virtual varType get##funName(void) const { return varName; }\public: virtual void set##funName(varType var){ varName = var; }#define CC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName)\protected: varType varName;\public: virtual const varType& get##funName(void) const { return varName; }\public: virtual void set##funName(const varType& var){ varName = var; }#define CC_SYNTHESIZE_RETAIN(varType, varName, funName) \private: varType varName; \public: virtual varType get##funName(void) const { return varName; } \public: virtual void set##funName(varType var) \{ \ if (varName != var) \ { \ CC_SAFE_RETAIN(var); \ CC_SAFE_RELEASE(varName); \ varName = var; \ } \} #define CC_SAFE_DELETE(p) do { if(p) { delete (p); (p) = 0; } } while(0)#define CC_SAFE_DELETE_ARRAY(p) do { if(p) { delete[] (p); (p) = 0; } } while(0)#define CC_SAFE_FREE(p) do { if(p) { free(p); (p) = 0; } } while(0)#define CC_SAFE_RELEASE(p) do { if(p) { (p)->release(); } } while(0)#define CC_SAFE_RELEASE_NULL(p) do { if(p) { (p)->release(); (p) = 0; } } while(0)#define CC_SAFE_RETAIN(p) do { if(p) { (p)->retain(); } } while(0)#define CC_BREAK_IF(cond) if(cond) break#define __CCLOGWITHFUNCTION(s, ...) \ CCLog("%s : %s",__FUNCTION__, CCString::createWithFormat(s, ##__VA_ARGS__)->getCString())// cocos2d debug#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0#define CCLOG(...) do {} while (0)#define CCLOGINFO(...) do {} while (0)#define CCLOGERROR(...) do {} while (0)#define CCLOGWARN(...) do {} while (0)#elif COCOS2D_DEBUG == 1#define CCLOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__)#define CCLOGERROR(format,...) cocos2d::CCLog(format, ##__VA_ARGS__)#define CCLOGINFO(format,...) do {} while (0)#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)#elif COCOS2D_DEBUG > 1#define CCLOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__)#define CCLOGERROR(format,...) cocos2d::CCLog(format, ##__VA_ARGS__)#define CCLOGINFO(format,...) cocos2d::CCLog(format, ##__VA_ARGS__)#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)#endif // COCOS2D_DEBUG// Lua engine debug#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 || CC_LUA_ENGINE_DEBUG == 0#define LUALOG(...)#else#define LUALOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__)#endif // Lua engine debug/* * only certain compilers support __attribute__((deprecated)) */#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) #define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated))#elif _MSC_VER >= 1400 //vs 2005 or higher#define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated) #else #define CC_DEPRECATED_ATTRIBUTE#endif
0 0
- cocos2dx之一些宏的作用
- cocos2dx 的一些宏的作用
- Cocos2dx中TableView中一些函数的作用
- cocos2dx中供类使用的一些宏
- ovm一些宏的作用
- 使用cocos2dx的一些经验
- cocos2dx一些重要的类
- Cocos2dx中的一些设计到内存管理的宏
- cocos2dx -一些相关的宏定义函数使用
- Cocos2dx常用的一些宏定义和头文件
- 寒風的Cocos2dx之旅之完成2048后遇到的一些小问题
- 寒風的Cocos2dx之旅之一些游戏在控制方向的技巧
- Cocos2d-x 一些常见宏的作用
- cocos2dx调试之cocos2dx的Log改造
- 一些软件的作用
- 流迭代器的一些作用
- 一些jar的作用
- runtime 的一些作用
- 算法导论第三版4.1最大和子数组思考
- 谷歌携Chromebox会议套件进入视频会议市场
- Spring MVC 文件上传下载
- 串结构练习——字符串匹配
- 心理学-性格
- cocos2dx之一些宏的作用
- 小明传奇1
- Weblogic 配置代理服务器
- NYOJ 845 无主之地1
- 对装配中组件进行镜像
- zeoslib:取得数据库中某张表的主关键字
- Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_MAMapServices", referenced from: o
- 同步软键盘自定义工具条
- 拓扑排序