CCConfiguration(配置类 可以得到当前载体的支持功能信息 )

#ifndef __CCCONFIGURATION_H__

#define __CCCONFIGURATION_H__


#include "cocoa/CCObject.h"

#include "CCGL.h"

#include "cocoa/CCString.h"

#include <string>




NS_CC_BEGIN


typedef enum _ccConfigurationType {

    ConfigurationError,

    ConfigurationString,

    ConfigurationInt,

    ConfigurationDouble,

    ConfigurationBoolean

} ccConfigurationType;


class CC_DLL CCConfiguration : public CCObject

{

public:

   //配置类 是一个全局单例

    static CCConfiguration *sharedConfiguration(void);


   //清空配置

    static void purgeConfiguration(void);


public:


virtual ~CCConfiguration(void);


    //OpenGL 最大 texture 尺寸

int getMaxTextureSize(void) const;


   //OpenGL 最大 Modelview Stack Depth.

int getMaxModelviewStackDepth(void) const;


int getMaxTextureUnits(void) const;


    /** Whether or not the GPU supports NPOT (Non Power Of Two) textures.

     OpenGL ES 2.0 already supports NPOT (iOS).

     

     @since v0.99.2

     */

bool supportsNPOT(void) const;


    /** Whether or not PVR Texture Compressed is supported */

//是否支持 PVR Texture 压缩

bool supportsPVRTC(void) const;


    /** Whether or not BGRA8888 textures are supported.

     @since v0.99.2

     */

//是否支持  BGRA8888 textures

bool supportsBGRA8888(void) const;


    /** Whether or not glDiscardFramebufferEXT is supported

     @since v0.99.2

     */

//是否支持 glDiscardFramebufferEXT  

bool supportsDiscardFramebuffer(void) const;


    /** Whether or not shareable VAOs are supported.

     @since v2.0.0

     */

//是否支持  VAOs(的增值运营与服务)

bool supportsShareableVAO(void) const;


    /** returns whether or not an OpenGL is supported */

    bool checkForGLExtension(const std::string &searchName) const;


    bool init(void);


/** returns the value of a given key as a string.

If the key is not found, it will return the default value */

//returns 给定的 key 对应的值(string)  ,如果该 key 没有被发现,它会返回默认值

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 给定的 key 对应的值(Object)

CCObject * getObject( const char *key ) const;


/** sets a new key/value pair  in the configuration dictionary */

void setObject( const char *key, CCObject *value );


/** dumps(倾倒) the current configuration on the console */

void dumpInfo(void) const;


/** gathers(收集 获得) OpenGL / GPU information */

void gatherGPUInfo( void );


/** Loads a config file. If the keys are already present, then they are going to be replaced. Otherwise the new keys are added. */

//加载一个配置文件,如果 keys 已经存在了,那么他将被替换掉,添加新的 keys.

void loadConfigFile( const char *filename );


private:

    CCConfiguration(void);

    static CCConfiguration *s_gSharedConfiguration;

static std::strings_sConfigfile;

    

protected:

    GLint           m_nMaxTextureSize;

    GLint           m_nMaxModelviewStackDepth;

    bool            m_bSupportsPVRTC;

    bool            m_bSupportsNPOT;

    bool            m_bSupportsBGRA8888;

    bool            m_bSupportsDiscardFramebuffer;

    bool            m_bSupportsShareableVAO;

    GLint           m_nMaxSamplesAllowed;

    GLint           m_nMaxTextureUnits;

    char *          m_pGlExtensions;

CCDictionary*m_pValueDict;

};


// end of global group

/// @}


NS_CC_END


#endif // __CCCONFIGURATION_H__


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值