2010-07-06 15:46:45 +08:00
|
|
|
/****************************************************************************
|
2011-03-19 10:34:26 +08:00
|
|
|
Copyright (c) 2010-2011 cocos2d-x.org
|
|
|
|
Copyright (c) 2010 Ricardo Quesada
|
2011-03-19 14:45:51 +08:00
|
|
|
|
2010-07-06 20:55:05 +08:00
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
2010-07-06 15:46:45 +08:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2010-07-06 11:01:14 +08:00
|
|
|
#ifndef __CCCONFIGURATION_H__
|
|
|
|
#define __CCCONFIGURATION_H__
|
|
|
|
|
2011-03-07 17:11:57 +08:00
|
|
|
#include "CCObject.h"
|
2010-07-06 11:01:14 +08:00
|
|
|
#include <string>
|
2010-12-28 15:05:55 +08:00
|
|
|
#include "CCGL.h"
|
2010-11-12 17:26:01 +08:00
|
|
|
|
2010-08-04 15:46:12 +08:00
|
|
|
namespace cocos2d {
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-12-28 15:05:55 +08:00
|
|
|
/** OS version definitions. Includes both iOS and Mac OS versions
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
kCCiOSVersion_3_0 = 0x03000000,
|
|
|
|
kCCiOSVersion_3_1 = 0x03010000,
|
|
|
|
kCCiOSVersion_3_1_1 = 0x03010100,
|
|
|
|
kCCiOSVersion_3_1_2 = 0x03010200,
|
|
|
|
kCCiOSVersion_3_1_3 = 0x03010300,
|
|
|
|
kCCiOSVersion_3_2 = 0x03020000,
|
|
|
|
kCCiOSVersion_3_2_1 = 0x03020100,
|
|
|
|
kCCiOSVersion_4_0 = 0x04000000,
|
|
|
|
kCCiOSVersion_4_0_1 = 0x04000100,
|
|
|
|
kCCiOSVersion_4_1 = 0x04010000,
|
|
|
|
|
|
|
|
kCCMacVersion_10_5 = 0x0a050000,
|
|
|
|
kCCMacVersion_10_6 = 0x0a060000,
|
|
|
|
kCCMacVersion_10_7 = 0x0a070000,
|
|
|
|
};
|
|
|
|
|
2010-07-06 15:46:45 +08:00
|
|
|
/**
|
2010-09-28 18:27:33 +08:00
|
|
|
@brief CCConfiguration contains some openGL variables
|
2010-07-06 15:46:45 +08:00
|
|
|
@since v0.99.0
|
2010-07-06 11:01:14 +08:00
|
|
|
*/
|
2011-03-07 17:11:57 +08:00
|
|
|
class CCConfiguration : public CCObject
|
2010-07-06 11:01:14 +08:00
|
|
|
{
|
|
|
|
protected:
|
2010-12-28 15:05:55 +08:00
|
|
|
GLint m_nMaxTextureSize;
|
|
|
|
GLint m_nMaxModelviewStackDepth;
|
|
|
|
bool m_bSupportsPVRTC;
|
|
|
|
bool m_bSupportsNPOT;
|
|
|
|
bool m_bSupportsBGRA8888;
|
|
|
|
bool m_bSupportsDiscardFramebuffer;
|
|
|
|
unsigned int m_uOSVersion;
|
|
|
|
GLint m_nMaxSamplesAllowed;
|
2010-07-06 11:01:14 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
CCConfiguration(void);
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** OpenGL Max texture size. */
|
2010-07-28 15:35:51 +08:00
|
|
|
inline int getMaxTextureSize(void)
|
|
|
|
{
|
|
|
|
return m_nMaxTextureSize;
|
|
|
|
}
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** OpenGL Max Modelview Stack Depth */
|
2010-07-28 15:35:51 +08:00
|
|
|
inline int getMaxModelviewStackDepth(void)
|
|
|
|
{
|
|
|
|
return m_nMaxModelviewStackDepth;
|
|
|
|
}
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-07-06 15:46:45 +08:00
|
|
|
/** Whether or not the GPU supports NPOT (Non Power Of Two) textures.
|
|
|
|
NPOT textures have the following limitations:
|
|
|
|
- They can't have mipmaps
|
|
|
|
- They only accept GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}
|
|
|
|
|
|
|
|
@since v0.99.2
|
2010-07-06 11:01:14 +08:00
|
|
|
*/
|
2010-07-28 15:35:51 +08:00
|
|
|
inline bool isSupportsNPOT(void)
|
|
|
|
{
|
|
|
|
return m_bSupportsNPOT;
|
|
|
|
}
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** Whether or not PVR Texture Compressed is supported */
|
2010-07-28 15:35:51 +08:00
|
|
|
inline bool isSupportsPVRTC(void)
|
|
|
|
{
|
|
|
|
return m_bSupportsPVRTC;
|
|
|
|
}
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-07-06 15:46:45 +08:00
|
|
|
/** Whether or not BGRA8888 textures are supported.
|
|
|
|
@since v0.99.2
|
2010-07-06 11:01:14 +08:00
|
|
|
*/
|
2010-07-28 15:35:51 +08:00
|
|
|
inline bool isSupportsBGRA8888(void)
|
|
|
|
{
|
|
|
|
return m_bSupportsBGRA8888;
|
|
|
|
}
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-07-06 15:46:45 +08:00
|
|
|
/** Whether or not glDiscardFramebufferEXT is supported
|
|
|
|
@since v0.99.2
|
2010-07-06 11:01:14 +08:00
|
|
|
*/
|
2010-07-28 15:35:51 +08:00
|
|
|
inline bool isSupportsDiscardFramebuffer(void)
|
|
|
|
{
|
|
|
|
return m_bSupportsDiscardFramebuffer;
|
|
|
|
}
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-12-28 15:05:55 +08:00
|
|
|
/** returns the OS version.
|
|
|
|
- On iOS devices it returns the firmware version.
|
|
|
|
- On Mac returns the OS version
|
|
|
|
|
|
|
|
@since v0.99.5
|
|
|
|
*/
|
|
|
|
inline unsigned int getOSVersion() { return m_uOSVersion; }
|
|
|
|
|
2010-09-28 16:18:05 +08:00
|
|
|
/** returns whether or not an OpenGL is supported */
|
2010-07-08 12:02:18 +08:00
|
|
|
bool checkForGLExtension(const std::string &searchName);
|
2010-07-06 11:01:14 +08:00
|
|
|
|
2010-09-04 12:02:52 +08:00
|
|
|
bool init(void);
|
2010-07-12 17:03:27 +08:00
|
|
|
|
2010-07-06 11:01:14 +08:00
|
|
|
public:
|
2010-09-28 16:18:05 +08:00
|
|
|
/** returns a shared instance of the CCConfiguration */
|
2010-07-06 11:01:14 +08:00
|
|
|
static CCConfiguration* sharedConfiguration(void);
|
|
|
|
};
|
2010-08-04 15:46:12 +08:00
|
|
|
}//namespace cocos2d
|
2010-07-06 11:01:14 +08:00
|
|
|
|
|
|
|
#endif // __CCCONFIGURATION_H__
|