COcos2d-X 节点(CCConfiguration.h)API

本文来自http://blog.csdn.net/runaying ,引用必须注明出处!

COcos2d-X 节点(CCConfiguration.h)API

温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记
///cocos2d-x-3.0alpha0/cocos2dx


#ifndef __CCCONFIGURATION_H__
#define __CCCONFIGURATION_H__

#include "cocoa/CCObject.h"
#include "CCGL.h"
#include "cocoa/CCString.h"
#include 



NS_CC_BEGIN

/**
 * @addtogroup global
 * @{
 */
/**
 @brief Configuration(配置) 包含一些openGL的变量
 @since v0.99.0
 */
class CC_DLL Configuration : public Object
{
public:
    
    /** returns 一个共享的 Configuration 实例 */
    static Configuration *getInstance();

    /** 清除共享的 Configuration 实例 */
    static void destroyInstance();

    /** @过时不再需要建议使用新的 API 使用 getInstance() 代替 */
    CC_DEPRECATED_ATTRIBUTE static Configuration *sharedConfiguration();

    /** @过时不再需要建议使用新的 API 使用 destroyInstance() 代替 */
    CC_DEPRECATED_ATTRIBUTE static void purgeConfiguration();

public:
    /**
     * @js NA
     * @lua NA
     */
	virtual ~Configuration();

    /** OpenGL 最大 texture 尺寸. */
	int getMaxTextureSize() const;

    /** OpenGL 最大 Modelview Stack Depth. */
	int getMaxModelviewStackDepth() const;

    /** returns the maximum(最大) texture units(单元)
     @since v2.0.0
     */
	int getMaxTextureUnits() const;

    /** GPU(图形处理器)是否支持 NPOT (Non Power Of Two) textures.        //2次幂尺寸的贴图 参考:http://www.cocoachina.com/bbs/simple/?t25633.html
     OpenGL ES 2.0 already supports NPOT (iOS).
     
     @since v0.99.2
     */
	bool supportsNPOT() const;

    /** 是否支持 PVR Texture 压缩 */
	bool supportsPVRTC() const;
    
     /** 是否支持 ETC Texture 压缩 */
    bool supportsETC() const;
    
    /** 是否支持 S3TC Texture 压缩*/
    bool supportsS3TC() const;
    
    /** 是否支持 ATITC Texture 压缩 */
    bool supportsATITC() const;
    
    /** 是否支持  BGRA8888 textures .
     @since v0.99.2
     */
	bool supportsBGRA8888() const;

    /** 是否支持 glDiscardFramebufferEXT 
     @since v0.99.2
     */
	bool supportsDiscardFramebuffer() const;

    /** 是否支持  VAOs(的增值运营与服务)
     @since v2.0.0
     */
	bool supportsShareableVAO() const;

    /** returns 是否支持 OpenGL */
    bool checkForGLExtension(const std::string &searchName) const;

    bool init();

	/** returns 给定的 key 对应的值(string)
	 如果该 key 没有被发现,它会返回默认值 */
	const char* getCString(const char *key, const char *defaultValue = nullptr) const;

	/** returns 给定的 key 对应的值(boolean) .
	  如果该 key 没有被发现,它会返回默认值 */
	bool getBool(const char *key, bool defaultValue = false) const;

	/** returns 给定的 key 对应的值(double) .
	  如果该 key 没有被发现,它会返回默认值 */
	double getNumber(const char *key, double defaultValue = 0.0) const;

	/** returns 给定的 key 对应的值(Object) */
	Object * getObject(const char *key) const;

	/** 在配置字典里建立一个新的 key/value 对 */
	void setObject(const char *key, Object *value);

	/** 在控制台转存当前配置 */
	void dumpInfo() const;

	/** gathers OpenGL / GPU 信息 */
	void gatherGPUInfo();

	/** 加载一个配置文件,如果 keys 已经存在了,那么他将被替换掉,添加新的 keys. */
	void loadConfigFile(const char *filename);

private:
    Configuration(void);
    static Configuration    *s_sharedConfiguration;
	static std::string		s_configfile;
    
protected:
    GLint           _maxTextureSize;
    GLint           _maxModelviewStackDepth;
    bool            _supportsPVRTC;
    bool            _supportsETC;
    bool            _supportsS3TC;
    bool            _supportsATITC;
    bool            _supportsNPOT;
    bool            _supportsBGRA8888;
    bool            _supportsDiscardFramebuffer;
    bool            _supportsShareableVAO;
    GLint           _maxSamplesAllowed;
    GLint           _maxTextureUnits;
    char *          _glExtensions;
	
	Dictionary	*_valueDict;
};

// end of global group
/// @}

NS_CC_END

#endif // __CCCONFIGURATION_H__


你可能感兴趣的:(cocos2d-x,cocos2d,cocos2d-x,cocos2dx)