cocos2d-x 3.0 |
)
- 文件列表 - 文件成员
全部) 类) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义) 组) 页)
CCPlatformMacros.h 文件参考
#include "base/ccConfig.h"
#include "base/CCPlatformConfig.h"
#include "CCPlatformDefine.h"
## 宏定义 | |
#define | CREATE_FUNC(TYPE) |
define some platform specific macros 更多… | |
#define | NODE_FUNC(TYPE) |
为特定类型定义一个节点方法,如 Layer 类型 更多… | |
#define | CC_ENABLE_CACHE_TEXTURE_DATA 1 |
如果你想缓存纹理数据则启用它. 更多… | |
#define | CC_REBIND_INDICES_BUFFER 1 |
#define | NS_CC_BEGIN |
#define | NS_CC_END |
#define | USING_NS_CC |
#define | CC_PROPERTY_READONLY(varType, varName, funName) |
CCPROPERTYREADONLY 用于声明保护性变量. 更多… | |
#define | CC_PROPERTY_READONLY_PASS_BY_REF(varType, varName, funName) |
#define | CC_PROPERTY(varType, varName, funName) |
CCPROPERTY 用于声明保护性变量. 更多… | |
#define | CC_PROPERTY_PASS_BY_REF(varType, varName, funName) |
#define | CC_SYNTHESIZE_READONLY(varType, varName, funName) |
CCSYNTHESIZE_READONLY 用于声明保护性变量. 更多… | |
#define | CC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName) |
#define | CC_SYNTHESIZE(varType, varName, funName) |
CC_SYNTHESIZE 用于声明保护性变量. 更多… | |
#define | CC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName) |
#define | CC_SYNTHESIZE_RETAIN(varType, varName, funName) |
#define | CC_SAFE_DELETE(p) do { delete (p); (p) = nullptr; } while(0) |
#define | CC_SAFE_DELETE_ARRAY(p) do { if(p) { delete[] (p); (p) = nullptr; } } while(0) |
#define | CC_SAFE_FREE(p) do { if(p) { free(p); (p) = nullptr; } } 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) = nullptr; } } 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,…) log("%s : %s",__FUNCTION, StringUtils::format(s, ##__VA_ARGS).c_str()) |
#define | CCLOG(…) do {} while (0) |
#define | CCLOGINFO(…) do {} while (0) |
#define | CCLOGERROR(…) do {} while (0) |
#define | CCLOGWARN(…) do {} while (0) |
#define | LUALOG(…) |
#define | CC_DISALLOW_COPY_AND_ASSIGN(TypeName) |
#define | CC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) |
#define | CC_DEPRECATED_ATTRIBUTE |
#define | CC_FORMAT_PRINTF(formatPos, argPos) |
#define | CC_FORMAT_PRINTF_SIZE_T "%08zX" |
#define | CC_UNUSED |
#define | CC_REQUIRES_NULL_TERMINATION |
宏定义说明
#define CCLOGWITHFUNCTION | ( | s, | |
… | |||
) | log("%s : %s",FUNCTION, StringUtils::format(s, ##VAARGS_).c_str()) |
#define CC_BREAK_IF | ( | cond | ) | if(cond) break |
#define CC_DEPRECATED_ATTRIBUTE |
#define CC_DISALLOW_COPY_AND_ASSIGN | ( | TypeName | ) |
值:
TypeName(const TypeName &); \
TypeName &operator =(const TypeName &);
#define CC_DISALLOW_IMPLICIT_CONSTRUCTORS | ( | TypeName | ) |
值:
TypeName(); \
CC_DISALLOW_COPY_AND_ASSIGN(TypeName)
define CC_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: CCPlatformMacros.h:246
#define CC_ENABLE_CACHE_TEXTURE_DATA 1 |
如果你想缓存纹理数据则启用它.
Emscripten不在启用——似乎并不必要,也不是我们想要的 不同于其他平台,除非有很好的理由
从cocos2d-x v0.99.5以来的新版本
#define CC_FORMAT_PRINTF | ( | formatPos, | |
argPos | |||
) |
#define CC_FORMAT_PRINTF_SIZE_T "%08zX" |
#define CC_PROPERTY | ( | varType, | |
varName, | |||
funName | |||
) |
值:
protected: varType varName;\
public: virtual varType get##funName(void);\
public: virtual void set##funName(varType var);
CC_PROPERTY 用于声明保护性变量.
我们可以使用getter 读取该变量, 和用setter修改该变量.
- 参数
varType变量类型. varName变量名. funName形如"get + funName" 将会是getter方法. 形如"set + funName" 将会是setter方法.
- 警告
- getter 和 setter 是公共的虚函数,你首先应该重写它. 在CC_PROPERTY声明变量和方法后,都是公共的. 如果你需要protected 或 private, 请声明.
#define CC_PROPERTY_PASS_BY_REF | ( | varType, | |
varName, | |||
funName | |||
) |
值:
protected: varType varName;\
public: virtual const varType& get##funName(void) const;\
public: virtual void set##funName(const varType& var);
#define CC_PROPERTY_READONLY | ( | varType, | |
varName, | |||
funName | |||
) |
值:
protected: varType varName;\
public: virtual varType get##funName(void) const;
CC_PROPERTY_READONLY 用于声明保护性变量.
我们可以用 getter读取该变量.
- 参数
varType变量类型. varName变量名. funName形如"get + funName" 将会是getter方法名.
- 警告
- getter是一个公共的虚函数,你首先应该重写它. 在CC_PROPERTY_READONLY声明变量和方法后,都是公共的. 如果你需要protected 或 private, 请声明.
#define CC_PROPERTY_READONLY_PASS_BY_REF | ( | varType, | |
varName, | |||
funName | |||
) |
值:
protected: varType varName;\
public: virtual const varType& get##funName(void) const;
#define CC_REBIND_INDICES_BUFFER 1 |
#define CC_REQUIRES_NULL_TERMINATION |
#define CC_SAFE_DELETE | ( | p | ) | do { delete (p); (p) = nullptr; } while(0) |
#define CC_SAFE_DELETE_ARRAY | ( | p | ) | do { if(p) { delete[] (p); (p) = nullptr; } } while(0) |
#define CC_SAFE_FREE | ( | p | ) | do { if(p) { free(p); (p) = nullptr; } } 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) = nullptr; } } while(0) |
#define CC_SAFE_RETAIN | ( | p | ) | do { if(p) { (p)->retain(); } } while(0) |
#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; }
CC_SYNTHESIZE 用于声明保护性变量.
我们可以使用getter 读取该变量, 和用setter修改该变量.
- 参数
varType变量类型. varName变量名. funName形如"get + funName" 将会是getter方法. 形如"set + funName" 将会是setter方法.
- 警告
- getter 和 setter 是公共的内部函数. 在CC_SYNTHESIZE声明变量和方法后,都是公共的. 如果你需要protected 或 private, 请声明.
#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_READONLY | ( | varType, | |
varName, | |||
funName | |||
) |
值:
protected: varType varName;\
public: virtual varType get##funName(void) const { return varName; }
CC_SYNTHESIZE_READONLY 用于声明保护性变量.
我们可以用 getter读取该变量.
- 参数
varType变量类型. varName变量名. funName形如"get + funName" 将会是getter方法名.
- 警告
- getter 是一个公共性的内部函数. 在CC_SYNTHESIZE_READONLY声明变量和方法后,都是公共的. 如果你需要protected 或 private, 请声明.
#define CC_SYNTHESIZE_READONLY_PASS_BY_REF | ( | varType, | |
varName, | |||
funName | |||
) |
值:
protected: varType varName;\
public: virtual const varType& get##funName(void) const { return varName; }
#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_RELEASE(p)
Definition: CCPlatformMacros.h:203
define CC_SAFE_RETAIN(p)
Definition: CCPlatformMacros.h:205
#define CC_UNUSED |
#define CCLOG | ( | … | ) | do {} while (0) |
#define CCLOGERROR | ( | … | ) | do {} while (0) |
#define CCLOGINFO | ( | … | ) | do {} while (0) |
#define CCLOGWARN | ( | … | ) | do {} while (0) |
#define CREATEFUNC | ( | _TYPE | ) |
值:
static TYPE* create() \
{ \
TYPE *pRet = new TYPE(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
define NULL
Definition: CCPlatformDefine.h:61
define some platform specific macros
定义一个各种类型的工厂方法, 如 Layer 类型
- 参数
TYPE类类型加入到create(), 如 Layer 类型
#define LUALOG | ( | … | ) |
#define NODEFUNC | ( | _TYPE | ) |
值:
CC_DEPRECATED_ATTRIBUTE static TYPE* node() \
{ \
TYPE *pRet = new TYPE(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
define CC_DEPRECATED_ATTRIBUTE
Definition: CCPlatformMacros.h:269
define NULL
Definition: CCPlatformDefine.h:61
为特定类型定义一个节点方法,如 Layer 类型
- 参数
TYPE类类型加入到node(), 如Layer
- 弃用:
- 该接口迟早会被弃用.
#define NS_CC_BEGIN |
#define NS_CC_END |
#define USING_NS_CC |
- cocos
- base
- CCPlatformMacros.h
- 生成于 2014年 五月 29日 星期四 09:41:42 , 为 cocos2d-x使用 1.8.6