Cocos2d-x   发布时间:2022-05-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了cocos2dx 源码学习3 CCConfiguration大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

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所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: