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;
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
总结以上是内存溢出为你收集整理的cocos2dx 源码学习3 CCConfiguration全部内容,希望文章能够帮你解决cocos2dx 源码学习3 CCConfiguration所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)