CCConfiguration对一些配置信息进行设置,在源码中是用字典来存储这些信息的,及key/value的方式。CCConfiguration也提供了很多函数来返回这些信息。其次CCConfiguration被设计成了单例。下面看下CCConfiguration的成员:
protected:
GLint m_nMaxTextureSize;/**OpenGL最大texture尺寸.*/
GLint m_nMaxModelviewStackDepth;/**OpenGL最大ModelviewStackDepth.*/
bool m_bSupportsPVRTC;/**是否支持PVRTexture压缩*/
bool m_bSupportsNPOT;/**GPU(图形处理器)是否支持NPOT(NonPowerOfTwo)textures.
bool m_bSupportsBGRA8888;/**是否支持BGRA8888textures.
bool m_bSupportsDiscardFramebuffer;/**是否支持glDiscardFramebufferEXT
bool m_bSupportsShareableVAO;/**是否支持VAOs(的增值运营与服务)
GLint m_nMaxSamplesAllowed;
GLint m_nMaxTextureUnits;/**returnsthemaximum(最大)textureunits(单元)
char * m_pGlExtensions;
@H_403_45@
CCDictionary@H_403_45@ *m_pValueDict;
可以看出m_pValueDict及是用来保存的字典变量。同时可以看到一些这些私有变量的获取方法以及设置方法:
/** OpenGL Max texture size. */
@H_403_45@int getMaxTextureSize(void) const;
/** OpenGL Max Modelview Stack Depth. */
@H_403_45@int getMaxModelviewStackDepth(void) const;
/** returns the maximum texture units*/
@H_403_45@int getMaxTextureUnits(void) const;
/** Whether or not the GPU supports NPOT (Non Power Of Two) textures.
OpenGL ES 2.0 already supports NPOT (iOS).*/
@H_403_45@bool supportsNPOT(void) const;
/** Whether or not PVR Texture Compressed is supported */
@H_403_45@bool supportsPVRTC(void) const;
/** Whether or not BGRA8888 textures are supported.*/
bool supportsBGRA8888(void) const;
/** Whether or not glDiscardFramebufferEXT is supported*/
bool supportsDiscardFramebuffer(void) const;
/** Whether or not shareable VAOs are supported.*/
bool supportsShareableVAO(void) const;
/** returns whether or not an OpenGL is supported */
bool checkForGLExtension(const std::string &searchName) const;
/** returns the value of a given key as a string.If the key is not found,it will return the default value */
const char* getCString( const char *key,const char *default_value=NULL ) const;
/** returns the value of a given key as a boolean.If the key is not found,it will return the default value */
bool getBool( const char *key,bool default_value=false ) const;
@H_403_45@/** returns the value of a given key as a double.If the key is not found,it will return the default value */
@H_403_45@double getNumber( const char *key,double default_value=0.0 ) const;
@H_403_45@/** returns the value of a given key as a double */
@H_403_45@CCObject * getObject( const char *key ) const;
@H_403_45@/** sets a new key/value pair in the configuration dictionary */
@H_403_45@void setObject( const char *key,CCObject *value );
具体可以参考这篇文章:http://blog.csdn.net/runaying/article/details/15026685
原文链接:/cocos2dx/346226.html