axmol/cocos2dx/CCConfiguration.h

108 lines
3.1 KiB
C
Raw Normal View History

2010-07-06 15:46:45 +08:00
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
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__
#include "NSObject.h"
2010-07-06 11:01:14 +08:00
#include <GLES/gl.h>
#include <string>
2010-08-04 15:46:12 +08:00
namespace cocos2d {
2010-07-06 11:01:14 +08:00
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
*/
2010-07-06 11:59:23 +08:00
class CCConfiguration : public NSObject
2010-07-06 11:01:14 +08:00
{
protected:
GLint m_nMaxTextureSize;
GLint m_nMaxModelviewStackDepth;
bool m_bSupportsPVRTC;
bool m_bSupportsNPOT;
bool m_bSupportsBGRA8888;
bool m_bSupportsDiscardFramebuffer;
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-09-28 16:18:05 +08:00
/** returns whether or not an OpenGL is supported */
bool checkForGLExtension(const std::string &searchName);
2010-07-06 11:01:14 +08:00
bool init(void);
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__