mirror of https://github.com/axmolengine/axmol.git
issue #1310: Some typo fixes. Updated CCTexture2D.h/.cpp.
This commit is contained in:
parent
62f87c18a2
commit
be362bef9b
|
@ -140,7 +140,7 @@ void CCActionManager::resumeTarget(CCObject *pTarget)
|
|||
}
|
||||
}
|
||||
|
||||
CCSet* CCActionManager::pauseAlllRunningActions()
|
||||
CCSet* CCActionManager::pauseAllRunningActions()
|
||||
{
|
||||
CCSet *idsWithActions = new CCSet();
|
||||
idsWithActions->autorelease();
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
/** Pauses all running actions, returning a list of targets whose actions were paused.
|
||||
*/
|
||||
CCSet* pauseAlllRunningActions();
|
||||
CCSet* pauseAllRunningActions();
|
||||
|
||||
/** Resume a set of targets (convenience function to reverse a pauseAllRunningActions call)
|
||||
*/
|
||||
|
|
|
@ -25,13 +25,12 @@ THE SOFTWARE.
|
|||
#ifndef __CCOBJECT_H__
|
||||
#define __CCOBJECT_H__
|
||||
|
||||
#include "CCCommon.h"
|
||||
#include "CCPlatformMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CCZone;
|
||||
class CCObject;
|
||||
class CCString;
|
||||
class CCNode;
|
||||
class CCEvent;
|
||||
|
||||
|
@ -64,7 +63,7 @@ public:
|
|||
bool isSingleRefrence(void);
|
||||
unsigned int retainCount(void);
|
||||
virtual bool isEqual(const CCObject* pObject);
|
||||
|
||||
|
||||
virtual void update(float dt) {CC_UNUSED_PARAM(dt);};
|
||||
|
||||
friend class CCAutoreleasePool;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
|
@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __NS_SET_H__
|
||||
#define __NS_SET_H__
|
||||
#ifndef __CC_SET_H__
|
||||
#define __CC_SET_H__
|
||||
|
||||
#include <set>
|
||||
#include "CCObject.h"
|
||||
|
@ -82,5 +82,5 @@ private:
|
|||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __NS_SET_H__
|
||||
#endif // __CC_SET_H__
|
||||
|
||||
|
|
|
@ -667,6 +667,50 @@ void CCTexture2D::setAntiAliasTexParameters()
|
|||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
}
|
||||
|
||||
const char* CCTexture2D::stringForFormat()
|
||||
{
|
||||
switch (m_ePixelFormat)
|
||||
{
|
||||
case kCCTexture2DPixelFormat_RGBA8888:
|
||||
return "RGBA8888";
|
||||
|
||||
case kCCTexture2DPixelFormat_RGB888:
|
||||
return "RGB888";
|
||||
|
||||
case kCCTexture2DPixelFormat_RGB565:
|
||||
return "RGB565";
|
||||
|
||||
case kCCTexture2DPixelFormat_RGBA4444:
|
||||
return "RGBA4444";
|
||||
|
||||
case kCCTexture2DPixelFormat_RGB5A1:
|
||||
return "RGB5A1";
|
||||
|
||||
case kCCTexture2DPixelFormat_AI88:
|
||||
return "AI88";
|
||||
|
||||
case kCCTexture2DPixelFormat_A8:
|
||||
return "A8";
|
||||
|
||||
case kCCTexture2DPixelFormat_I8:
|
||||
return "I8";
|
||||
|
||||
case kCCTexture2DPixelFormat_PVRTC4:
|
||||
return "PVRTC4";
|
||||
|
||||
case kCCTexture2DPixelFormat_PVRTC2:
|
||||
return "PVRTC2";
|
||||
|
||||
default:
|
||||
CCAssert(false , "unrecognised pixel format");
|
||||
CCLOG("stringForFormat: %ld, cannot give useful result", (long)m_ePixelFormat);
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Texture options for images that contains alpha
|
||||
//
|
||||
|
@ -683,50 +727,55 @@ CCTexture2DPixelFormat CCTexture2D::defaultAlphaPixelFormat()
|
|||
return g_defaultAlphaPixelFormat;
|
||||
}
|
||||
|
||||
unsigned int CCTexture2D::bitsPerPixelForFormat()
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
unsigned int CCTexture2D::bitsPerPixelForFormat(CCTexture2DPixelFormat format)
|
||||
{
|
||||
unsigned int ret=0;
|
||||
|
||||
switch (format) {
|
||||
case kCCTexture2DPixelFormat_RGBA8888:
|
||||
ret = 32;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGB888:
|
||||
// It is 32 and not 24, since its internal representation uses 32 bits.
|
||||
ret = 32;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGB565:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGBA4444:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGB5A1:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_AI88:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_A8:
|
||||
ret = 8;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_I8:
|
||||
ret = 8;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_PVRTC4:
|
||||
ret = 4;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_PVRTC2:
|
||||
ret = 2;
|
||||
break;
|
||||
default:
|
||||
ret = -1;
|
||||
CCAssert(false , "unrecognised pixel format");
|
||||
CCLOG("bitsPerPixelForFormat: %ld, cannot give useful result", (long)format);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int CCTexture2D::bitsPerPixelForFormat()
|
||||
{
|
||||
return this->bitsPerPixelForFormat(m_ePixelFormat);
|
||||
}
|
||||
|
||||
switch (m_ePixelFormat)
|
||||
{
|
||||
case kCCTexture2DPixelFormat_RGBA8888:
|
||||
ret = 32;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGB565:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_A8:
|
||||
ret = 8;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGBA4444:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGB5A1:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_PVRTC4:
|
||||
ret = 4;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_PVRTC2:
|
||||
ret = 2;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_I8:
|
||||
ret = 8;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_AI88:
|
||||
ret = 16;
|
||||
break;
|
||||
case kCCTexture2DPixelFormat_RGB888:
|
||||
// It is 32 and not 24, since its internal representation uses 32 bits.
|
||||
ret = 32;
|
||||
break;
|
||||
default:
|
||||
ret = -1;
|
||||
CCAssert(false, "illegal pixel format");
|
||||
CCLOG("bitsPerPixelForFormat: %d, cannot give useful result", m_ePixelFormat);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -190,16 +190,15 @@ public:
|
|||
*/
|
||||
void generateMipmap();
|
||||
|
||||
/** returns the pixel format.
|
||||
@since v2.0
|
||||
*/
|
||||
const char* stringForFormat();
|
||||
|
||||
/** returns the bits-per-pixel of the in-memory OpenGL texture
|
||||
@since v1.0
|
||||
*/
|
||||
unsigned int bitsPerPixelForFormat();
|
||||
|
||||
/** returns the pixel format in a NSString.
|
||||
@since v2.0
|
||||
*/
|
||||
CCString* stringForFormat();
|
||||
|
||||
unsigned int bitsPerPixelForFormat();
|
||||
|
||||
/** Helper functions that returns bits per pixels for a given format.
|
||||
@since v2.0
|
||||
|
|
Loading…
Reference in New Issue