您的位置:首页 > 其它

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

2014-05-21 18:49 483 查看
#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__
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐