CCConfiguration对一些配置信息进行设置,在源码中是用字典来存储这些信息的,及key/value的方式。CCConfiguration也提供了很多函数来返回这些信息。其次CCConfiguration被设计成了单例。下面看下CCConfiguration的成员:
protected: GLint m_nMaxTextureSize; GLint m_nMaxModelviewStackDepth; bool m_bSupportsPVRTC;/**是否支持PVRTexture压缩*/ bool m_bSupportsNPOT; bool m_bSupportsBGRA8888;/**是否支持BGRA8888textures. bool m_bSupportsDiscardFramebuffer;/**是否支持glDiscardFramebufferEXT bool m_bSupportsShareableVAO;/**是否支持VAOs(的增值运营与服务) GLint m_nMaxSamplesAllowed; GLint m_nMaxTextureUnits;/**returnsthemaximum(最大)textureunits(单元) char * m_pGlExtensions; CCDictionary *m_pValueDict;
可以看出m_pValueDict及是用来保存的字典变量。同时可以看到一些这些私有变量的获取方法以及设置方法:
/** OpenGL Max texture size. */ int getMaxTextureSize(void) const; /** OpenGL Max Modelview Stack Depth. */ int getMaxModelviewStackDepth(void) const;
/** returns the maximum texture units*/ int getMaxTextureUnits(void) const;
/** Whether or not the GPU supports NPOT (Non Power Of Two) textures. OpenGL ES 2.0 already supports NPOT (iOS).*/ bool supportsNPOT(void) const; /** Whether or not PVR Texture Compressed is supported */ 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; /** returns the value of a given key as a double.If the key is not found,it will return the default value */ double getNumber( const char *key,double default_value=0.0 ) const; /** returns the value of a given key as a double */ CCObject * getObject( const char *key ) const; /** sets a new key/value pair in the configuration dictionary */ void setObject( const char *key,CCObject *value );
具体可以参考这篇文章:http://blog.csdn.net/runaying/article/details/15026685 (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|