- 路径:
cocos2d-2.1beta3-x-2.1.0/cocos2dx/include/ccConfig.h
- 路径:
cocos2d-2.1beta3-x-2.1.0/cocos2dx/platform/mac/CCPlatformDefine.h
//注意我是以mac平台研究的, 其他平台略有不同 - 路径:
cocos2d-2.1beta3-x-2.1.0/cocos2dx/platform/CCPlatformMacros.h
ccConfig.h 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191//设置为1后会include CCPhysicsScript 和 CCPhysicsDebugNode 添加到物理引擎支持//需要保证Chipmunk在搜索路径中//设置为1后会include CCPhysicsScript 添加到Box2D的支持//同样需要保证Box2D会在搜索路径中/**设置为1后,2d学会维护一个OpenGL状态缓存来避免不必要的切换为了使用这个功能,需要用下列函数来替换GL的对应函数- ccGLUseProgram() instead of glUseProgram()- ccGLDeleteProgram() instead of glDeleteProgram()- ccGLBlendFunc() instead of glBlendFunc()如果这个功能被禁止, 那么这些函数会直接调用对应的GL函数, 当然就没有缓存了打开这个功能能提高速度如果你的代码是从GL ES 1.1升级过来的, 保持这个功能被禁用. 如果各种功能正常的话, 你可以启用这个功能#ifndef CC_ENABLE_GL_STATE_CACHE#define CC_ENABLE_GL_STATE_CACHE 1#endif/**启用后,纹理的坐标会用这个公式来计算- texCoord.left = (rect.origin.x*2+1) / (texture.wide*2);- texCoord.right = texCoord.left + (rect.size.width*2-2)/(texture.wide*2);The same for bottom and top.This formula prevents artifacts by using 99% of the texture.The "correct" way to prevent artifacts is by using the spritesheet-artifact-fixer.py or a similar tool.受影响的类:- CCSprite / CCSpriteBatchNode and subclasses: CCLabelBMFont, CCTMXTiledMap- CCLabelAtlas- CCQuadParticleSystem- CCTileMap*///默认0.5秒, 更新下FPS的数据. 数字越大FPS数据越可靠.//FPS数据显示位置,默认左下/** @def CC_DIRECTOR_DISPATCH_FAST_EVENTSIf enabled, and only when it is used with CCFastDirector, the main loop will wait 0.04 seconds todispatch all the events, even if there are not events to dispatch.If your game uses lot's of events (eg: touches) it might be a good idea to enable this feature.Otherwise, it is safe to leave it disabled.To enable set it to 1. Disabled by default.@warning This feature is experimental*//** @def CC_DIRECTOR_MAC_USE_DISPLAY_LINK_THREADIf enabled, cocos2d-mac will run on the Display Link thread. If disabled cocos2d-mac will run in its own thread.If enabled, the images will be drawn at the "correct" time, but the events might not be very responsive.If disabled, some frames might be skipped, but the events will be dispatched as they arrived.To enable set it to a 1, to disable it set to 0. Enabled by default.Only valid for cocos2d-mac. Not supported on cocos2d-ios.*//** @def CC_NODE_RENDER_SUBPIXELIf enabled, the CCNode objects (CCSprite, CCLabel,etc) will be able to render in subpixels.If disabled, integer pixels will be used.To enable set it to 1. Enabled by default.*//** @def CC_SPRITEBATCHNODE_RENDER_SUBPIXELIf enabled, the CCSprite objects rendered with CCSpriteBatchNode will be able to render in subpixels.If disabled, integer pixels will be used.To enable set it to 1. Enabled by default.*//** @def CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIPUse GL_TRIANGLE_STRIP instead of GL_TRIANGLES when rendering the texture atlas.It seems it is the recommend way, but it is much slower, so, enable it at your own riskTo enable set it to a value different than 0. Disabled by default.*///VAO定点数组对象/** @def CC_TEXTURE_ATLAS_USE_VAOBy default, CCTextureAtlas (used by many cocos2d classes) will use VAO (Vertex Array Objects).Apple recommends its usage but they might consume a lot of memory, specially if you use many of them.So for certain cases, where you might need hundreds of VAO objects, it might be a good idea to disable it.To disable it set it to 0. Enabled by default.*//* Some Windows display adapter driver cannot support VAO. *//* Some android devices cannot support VAO very well, so we disable it by default for android platform. *//* Blackberry also doesn't support this feature. *//** @def CC_USE_LA88_LABELSIf enabled, it will use LA88 (Luminance Alpha 16-bit textures) for CCLabelTTF objects.If it is disabled, it will use A8 (Alpha 8-bit textures).LA88 textures are 6% faster than A8 textures, but they will consume 2x memory.This feature is enabled by default.@since v0.99.5*//**启用后,所有CCSprite的子类都会花上一个边框,方便调试0 -- disabled1 -- draw bounding box2 -- draw texture box*///CCSpriteBatchNode的调试用加边框//CCLabelBMFont调试加边框//LabeltAtlas调试加边框/** @def CC_ENABLE_PROFILERSIf enabled, will activate various profilers within cocos2d. This statistical data will be output to the consoleonce per second showing average time (in milliseconds) required to execute the specific routine(s).Useful for debugging purposes only. It is recommended to leave it disabled.To enable set it to a value different than 0. Disabled by default.*//** Enable Lua engine debug log */
|
|
我们可以看到win32中不同的部分比如CC_DLL
Linux部分也是CC_DLL
不同
Android中比较不同的部分是CC_ASSERT
我们最后再来看下CCPlatformMacros.h