Cocos2d-x  v4
Configuration Class Reference

Configuration contains some openGL variables. More...

Inherits Ref.

Public Member Functions

virtual ~Configuration ()
 Destructor @js NA @lua NA.
 
int getMaxTextureSize () const
 OpenGL Max texture size. More...
 
int getMaxModelviewStackDepth () const
 OpenGL Max Modelview Stack Depth. More...
 
int getMaxTextureUnits () const
 Returns the maximum texture units. More...
 
bool supportsNPOT () const
 Whether or not the GPU supports NPOT (Non Power Of Two) textures. More...
 
bool supportsPVRTC () const
 Whether or not PVR Texture Compressed is supported. More...
 
bool supportsETC () const
 Whether or not ETC Texture Compressed is supported. More...
 
bool supportsS3TC () const
 Whether or not S3TC Texture Compressed is supported. More...
 
bool supportsATITC () const
 Whether or not ATITC Texture Compressed is supported. More...
 
bool supportsBGRA8888 () const
 Whether or not BGRA8888 textures are supported. More...
 
bool supportsDiscardFramebuffer () const
 Whether or not glDiscardFramebufferEXT is supported. More...
 
bool supportsShareableVAO () const
 Whether or not shareable VAOs are supported. More...
 
bool supportsOESDepth24 () const
 Whether or not OES_depth24 is supported. More...
 
bool supportsOESPackedDepthStencil () const
 Whether or not OES_Packed_depth_stencil is supported. More...
 
bool supportsMapBuffer () const
 Whether or not glMapBuffer() is supported. More...
 
int getMaxSupportDirLightInShader () const
 Max support directional light in shader, for Sprite3D. More...
 
int getMaxSupportPointLightInShader () const
 Max support point light in shader, for Sprite3D. More...
 
int getMaxSupportSpotLightInShader () const
 Max support spot light in shader, for Sprite3D. More...
 
Animate3DQuality getAnimate3DQuality () const
 get 3d animate quality
 
bool checkForGLExtension (const std::string &searchName) const
 Returns whether or not an OpenGL is supported. More...
 
bool init ()
 Initialize method. More...
 
const Value & getValue (const std::string &key, const Value &defaultValue=Value::Null) const
 Returns the value of a given key as a double. More...
 
void setValue (const std::string &key, const Value &value)
 Sets a new key/value pair in the configuration dictionary. More...
 
std::string getInfo () const
 Returns the Configuration info. More...
 
void gatherGPUInfo ()
 Gathers OpenGL / GPU information.
 
void loadConfigFile (const std::string &filename)
 Loads a config file. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Static Public Member Functions

static ConfigurationgetInstance ()
 Returns a shared instance of Configuration. More...
 
static void destroyInstance ()
 Purge the shared instance of Configuration.
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

Configuration contains some openGL variables.

Since
v0.99.0 @js NA

Member Function Documentation

◆ getInstance()

static Configuration* getInstance ( )
static

Returns a shared instance of Configuration.

Returns
An autoreleased Configuration object.

◆ getMaxTextureSize()

int getMaxTextureSize ( ) const

OpenGL Max texture size.

Returns
The OpenGL Max texture size.

◆ getMaxModelviewStackDepth()

int getMaxModelviewStackDepth ( ) const

OpenGL Max Modelview Stack Depth.

Returns
The OpenGL Max Modelview Stack Depth.

◆ getMaxTextureUnits()

int getMaxTextureUnits ( ) const

Returns the maximum texture units.

Returns
The maximum texture units.
Since
v2.0.0

◆ supportsNPOT()

bool supportsNPOT ( ) const

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

OpenGL ES 2.0 already supports NPOT (iOS).

Returns
Is true if supports NPOT.
Since
v0.99.2

◆ supportsPVRTC()

bool supportsPVRTC ( ) const

Whether or not PVR Texture Compressed is supported.

Returns
Is true if supports PVR Texture Compressed.

◆ supportsETC()

bool supportsETC ( ) const

Whether or not ETC Texture Compressed is supported.

Returns
Is true if supports ETC Texture Compressed.

◆ supportsS3TC()

bool supportsS3TC ( ) const

Whether or not S3TC Texture Compressed is supported.

Returns
Is true if supports S3TC Texture Compressed.

◆ supportsATITC()

bool supportsATITC ( ) const

Whether or not ATITC Texture Compressed is supported.

Returns
Is true if supports ATITC Texture Compressed.

◆ supportsBGRA8888()

bool supportsBGRA8888 ( ) const

Whether or not BGRA8888 textures are supported.

Returns
Is true if supports BGRA8888 textures.
Since
v0.99.2

◆ supportsDiscardFramebuffer()

bool supportsDiscardFramebuffer ( ) const

Whether or not glDiscardFramebufferEXT is supported.

Returns
Is true if supports glDiscardFramebufferEXT.
Since
v0.99.2

◆ supportsShareableVAO()

bool supportsShareableVAO ( ) const

Whether or not shareable VAOs are supported.

Returns
Is true if supports shareable VAOs.
Since
v2.0.0

◆ supportsOESDepth24()

bool supportsOESDepth24 ( ) const

Whether or not OES_depth24 is supported.

Returns
Is true if supports OES_depth24.
Since
v2.0.0

◆ supportsOESPackedDepthStencil()

bool supportsOESPackedDepthStencil ( ) const

Whether or not OES_Packed_depth_stencil is supported.

Returns
Is true if supports OES_Packed_depth_stencil.
Since
v2.0.0

◆ supportsMapBuffer()

bool supportsMapBuffer ( ) const

Whether or not glMapBuffer() is supported.

On Desktop it returns true. On Mobile it checks for the extension GL_OES_mapbuffer

Returns
Whether or not glMapBuffer() is supported.
Since
v3.13

◆ getMaxSupportDirLightInShader()

int getMaxSupportDirLightInShader ( ) const

Max support directional light in shader, for Sprite3D.

Returns
Maximum supports directional light in shader.
Since
v3.3

◆ getMaxSupportPointLightInShader()

int getMaxSupportPointLightInShader ( ) const

Max support point light in shader, for Sprite3D.

Returns
Maximum supports point light in shader.
Since
v3.3

◆ getMaxSupportSpotLightInShader()

int getMaxSupportSpotLightInShader ( ) const

Max support spot light in shader, for Sprite3D.

Returns
Maximum supports spot light in shader.
Since
v3.3

◆ checkForGLExtension()

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

Returns whether or not an OpenGL is supported.

Parameters
searchNameA given search name.
Returns
Is true if an OpenGL is supported.

◆ init()

bool init ( )

Initialize method.

Returns
Is true if initialize success.

◆ getValue()

const Value& getValue ( const std::string &  key,
const Value &  defaultValue = Value::Null 
) const

Returns the value of a given key as a double.

Parameters
keyA given key.
defaultValueif not find the value, return the defaultValue.
Returns

◆ setValue()

void setValue ( const std::string &  key,
const Value &  value 
)

Sets a new key/value pair in the configuration dictionary.

Parameters
keyA given key.
valueA given value.

◆ getInfo()

std::string getInfo ( ) const

Returns the Configuration info.

Returns
The Configuration info.

◆ loadConfigFile()

void loadConfigFile ( const std::string &  filename)

Loads a config file.

If the keys are already present, then they are going to be replaced. Otherwise the new keys are added.

Parameters
filenameConfig file name.

The documentation for this class was generated from the following file: