[ci skip]Update comments.

This commit is contained in:
WenhaiLin 2015-03-25 10:59:04 +08:00
parent 89f9ae044d
commit 153d697f1a
3 changed files with 172 additions and 128 deletions

View File

@ -40,6 +40,8 @@ NS_CC_BEGIN
/**
* @brief Possible GlyphCollection used by Label.
*
* Specify a collections of characters to be load when Label created.
* Consider using DYNAMIC.
*/
enum class GlyphCollection {
DYNAMIC,
@ -61,14 +63,16 @@ enum class LabelEffect {
/**
* @struct TTFConfig
*
* @see `GlyphCollection`
*/
typedef struct _ttfConfig
{
std::string fontFilePath;
int fontSize;
GlyphCollection glyphs;
GlyphCollection glyphs;
const char *customGlyphs;
bool distanceFieldEnabled;
int outlineSize;

View File

@ -25,18 +25,18 @@ Copyright (c) 2013-2015 Chukong Technologies
#ifndef __CC_PLATFORM_MACROS_H__
#define __CC_PLATFORM_MACROS_H__
/// @cond DO_NOT_SHOW
/**
* define some platform specific macros
* Define some platform specific macros.
*/
#include "base/ccConfig.h"
#include "platform/CCPlatformConfig.h"
#include "platform/CCPlatformDefine.h"
/**
* define a create function for a specific type, such as Layer
* @param \__TYPE__ class type to add create(), such as Layer
/** @def CREATE_FUNC(__TYPE__)
* Define a create function for a specific type, such as Layer.
*
* @param __TYPE__ class type to add create(), such as Layer.
*/
#define CREATE_FUNC(__TYPE__) \
static __TYPE__* create() \
@ -55,9 +55,10 @@ static __TYPE__* create() \
} \
}
/**
* define a node function for a specific type, such as Layer
* @param \__TYPE__ class type to add node(), such as Layer
/** @def NODE_FUNC(__TYPE__)
* Define a node function for a specific type, such as Layer.
*
* @param __TYPE__ class type to add node(), such as Layer.
* @deprecated This interface will be deprecated sooner or later.
*/
#define NODE_FUNC(__TYPE__) \
@ -78,12 +79,12 @@ CC_DEPRECATED_ATTRIBUTE static __TYPE__* node() \
}
/** @def CC_ENABLE_CACHE_TEXTURE_DATA
Enable it if you want to cache the texture data.
Not enabling for Emscripten any more -- doesn't seem necessary and don't want
to be different from other platforms unless there's a good reason.
It's new in cocos2d-x since v0.99.5
*/
* Enable it if you want to cache the texture data.
* Not enabling for Emscripten any more -- doesn't seem necessary and don't want
* to be different from other platforms unless there's a good reason.
*
* @since v0.99.5
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#define CC_ENABLE_CACHE_TEXTURE_DATA 1
#else
@ -91,17 +92,18 @@ It's new in cocos2d-x since v0.99.5
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN)
/* Application will crash in glDrawElements function on some win32 computers and some android devices.
Indices should be bound again while drawing to avoid this bug.
/** Application will crash in glDrawElements function on some win32 computers and some android devices.
* Indices should be bound again while drawing to avoid this bug.
*/
#define CC_REBIND_INDICES_BUFFER 1
#else
#define CC_REBIND_INDICES_BUFFER 0
#endif
// generic macros
// Generic macros
// namespace cocos2d {}
/// @name namespace cocos2d
/// @{
#ifdef __cplusplus
#define NS_CC_BEGIN namespace cocos2d {
#define NS_CC_END }
@ -113,15 +115,18 @@ It's new in cocos2d-x since v0.99.5
#define USING_NS_CC
#define NS_CC
#endif
// end of namespace group
/// @}
/** 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" will be 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.
/** @def CC_PROPERTY_READONLY
* It 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" will be 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;\
@ -131,15 +136,17 @@ public: virtual varType get##funName(void) const;
protected: varType varName;\
public: virtual const varType& get##funName(void) const;
/** 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" will be the name of the getter.
"set + funName" will be 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.
/** @def CC_PROPERTY
* It 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" will be the name of the getter.
* "set + funName" will be 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;\
@ -151,14 +158,15 @@ protected: varType varName;\
public: virtual const varType& get##funName(void) const;\
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" will be 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.
/** @def CC_SYNTHESIZE_READONLY
* It 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" will be 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;\
@ -168,15 +176,17 @@ public: virtual varType get##funName(void) const { return varName; }
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" will be the name of the getter.
"set + funName" will be 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.
/** @def CC_SYNTHESIZE
* It 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" will be the name of the getter.
* "set + funName" will be 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;\
@ -212,7 +222,8 @@ public: virtual void set##funName(varType var) \
#define __CCLOGWITHFUNCTION(s, ...) \
log("%s : %s",__FUNCTION__, StringUtils::format(s, ##__VA_ARGS__).c_str())
// cocos2d debug
/// @name Cocos2d debug
/// @{
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
#define CCLOG(...) do {} while (0)
#define CCLOGINFO(...) do {} while (0)
@ -232,15 +243,20 @@ public: virtual void set##funName(varType var) \
#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)
#endif // COCOS2D_DEBUG
// Lua engine debug
/** Lua engine debug */
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 || CC_LUA_ENGINE_DEBUG == 0
#define LUALOG(...)
#else
#define LUALOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
#endif // Lua engine debug
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
// end of debug group
/// @}
/** @def CC_DISALLOW_COPY_AND_ASSIGN(TypeName)
* A macro to disallow the copy constructor and operator= functions.
* This should be used in the private: declarations for a class
*/
#if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \
|| (defined(__clang__) && (__clang_major__ >= 3)) || (_MSC_VER >= 1800)
#define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
@ -252,18 +268,20 @@ public: virtual void set##funName(varType var) \
TypeName &operator =(const TypeName &);
#endif
// A macro to disallow all the implicit constructors, namely the
// default constructor, copy constructor and operator= functions.
//
// This should be used in the private: declarations for a class
// that wants to prevent anyone from instantiating it. This is
// especially useful for classes containing only static methods.
/** @def CC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName)
* A macro to disallow all the implicit constructors, namely the
* default constructor, copy constructor and operator= functions.
*
* This should be used in the private: declarations for a class
* that wants to prevent anyone from instantiating it. This is
* especially useful for classes containing only static methods.
*/
#define CC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
TypeName(); \
CC_DISALLOW_COPY_AND_ASSIGN(TypeName)
/*
* only certain compilers support __attribute__((deprecated))
/** @def CC_DEPRECATED_ATTRIBUTE
* Only certain compilers support __attribute__((deprecated)).
*/
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
@ -273,17 +291,18 @@ public: virtual void set##funName(varType var) \
#define CC_DEPRECATED_ATTRIBUTE
#endif
/*
* macro to mark things deprecated as of a particular version
* can be used with artibrary parameters which are thrown away
/** @def CC_DEPRECATED(...)
* Macro to mark things deprecated as of a particular version
* can be used with artibrary parameters which are thrown away.
* e.g. CC_DEPRECATED(4.0) or CC_DEPRECATED(4.0, "not going to need this anymore") etc.
*/
#define CC_DEPRECATED(...) CC_DEPRECATED_ATTRIBUTE
/*
* only certain compiler support __attribute__((format))
* formatPos - 1-based position of format string argument
* argPos - 1-based position of first format-dependent argument
/** @def CC_FORMAT_PRINTF(formatPos, argPos)
* Only certain compiler support __attribute__((format))
*
* @param formatPos 1-based position of format string argument.
* @param argPos 1-based position of first format-dependent argument.
*/
#if defined(__GNUC__) && (__GNUC__ >= 4)
#define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos)))
@ -307,9 +326,9 @@ public: virtual void set##funName(varType var) \
#define CC_UNUSED
#endif
//
// CC_REQUIRES_NULL_TERMINATION
//
/** @def CC_REQUIRES_NULL_TERMINATION
*
*/
#if !defined(CC_REQUIRES_NULL_TERMINATION)
#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 5549)
#define CC_REQUIRES_NULL_TERMINATION __attribute__((sentinel(0,1)))

View File

@ -2,7 +2,7 @@
Copyright (c) 2011 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (C) 2013-2014 Chukong Technologies Inc.
Copyright (C) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@ -36,7 +36,7 @@ THE SOFTWARE.
NS_CC_BEGIN
/**
* @addtogroup shaders
* @addtogroup support
* @{
*/
@ -44,7 +44,7 @@ class GLProgram;
namespace GL {
/** vertex attrib flags */
/** Vertex attrib flags. */
enum {
VERTEX_ATTRIB_FLAG_NONE = 0,
@ -58,95 +58,116 @@ enum {
VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = (VERTEX_ATTRIB_FLAG_POSITION | VERTEX_ATTRIB_FLAG_COLOR | VERTEX_ATTRIB_FLAG_TEX_COORD),
};
/** @file ccGLStateCache.h
*/
/** Invalidates the GL state cache.
If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.
@since v2.0.0
/**
* Invalidates the GL state cache.
*
* If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.
* @since v2.0.0
*/
void CC_DLL invalidateStateCache(void);
/** Uses the GL program in case program is different than the current one.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly.
@since v2.0.0
/**
* Uses the GL program in case program is different than the current one.
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly.
* @since v2.0.0
*/
void CC_DLL useProgram(GLuint program);
/** Deletes the GL program. If it is the one that is being used, it invalidates it.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly.
@since v2.0.0
/**
* Deletes the GL program. If it is the one that is being used, it invalidates it.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly.
* @since v2.0.0
*/
void CC_DLL deleteProgram(GLuint program);
/** Uses a blending function in case it not already used.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.
@since v2.0.0
/**
* Uses a blending function in case it not already used.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.
* @since v2.0.0
*/
void CC_DLL blendFunc(GLenum sfactor, GLenum dfactor);
/** Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation().
If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD.
@since v2.0.0
/**
* Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation().
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD.
* @since v2.0.0
*/
void CC_DLL blendResetToCache(void);
/** sets the projection matrix as dirty
@since v2.0.0
/**
* Sets the projection matrix as dirty.
* @since v2.0.0
*/
void CC_DLL setProjectionMatrixDirty(void);
/** Will enable the vertex attribs that are passed as flags.
Possible flags:
* VERTEX_ATTRIB_FLAG_POSITION
* VERTEX_ATTRIB_FLAG_COLOR
* VERTEX_ATTRIB_FLAG_TEX_COORDS
These flags can be ORed. The flags that are not present, will be disabled.
@since v2.0.0
/**
* Will enable the vertex attribs that are passed as flags.
* Possible flags:
*
* * VERTEX_ATTRIB_FLAG_POSITION
* * VERTEX_ATTRIB_FLAG_COLOR
* * VERTEX_ATTRIB_FLAG_TEX_COORDS
*
* These flags can be ORed. The flags that are not present, will be disabled.
*
* @since v2.0.0
*/
void CC_DLL enableVertexAttribs(uint32_t flags);
/** If the texture is not already bound to texture unit 0, it binds it.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
@since v2.0.0
/**
* If the texture is not already bound to texture unit 0, it binds it.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
* @since v2.0.0
*/
void CC_DLL bindTexture2D(GLuint textureId);
/** If the texture is not already bound to a given unit, it binds it.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
@since v2.1.0
/**
* If the texture is not already bound to a given unit, it binds it.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
* @since v2.1.0
*/
void CC_DLL bindTexture2DN(GLuint textureUnit, GLuint textureId);
/** It will delete a given texture. If the texture was bound, it will invalidate the cached.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
@since v2.0.0
/**
* It will delete a given texture. If the texture was bound, it will invalidate the cached.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
* @since v2.0.0
*/
void CC_DLL deleteTexture(GLuint textureId);
/** It will delete a given texture. If the texture was bound, it will invalidate the cached for the given texture unit.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
@since v2.1.0
/**
* It will delete a given texture. If the texture was bound, it will invalidate the cached for the given texture unit.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
* @since v2.1.0
*/
CC_DEPRECATED_ATTRIBUTE void CC_DLL deleteTextureN(GLuint textureUnit, GLuint textureId);
/** Select active texture unit.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.
@since v3.0
/**
* Select active texture unit.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly.
* @since v3.0
*/
void CC_DLL activeTexture(GLenum texture);
/** If the vertex array is not already bound, it binds it.
If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
@since v2.0.0
/**
* If the vertex array is not already bound, it binds it.
*
* If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
* @since v2.0.0
*/
void CC_DLL bindVAO(GLuint vaoId);
// end of shaders group
// end of support group
/// @}
} // Namespace GL