mirror of https://github.com/axmolengine/axmol.git
Merge branch 'gles20' of https://github.com/cocos2d/cocos2d-x into gles20
This commit is contained in:
commit
86d34f05c4
|
@ -58,7 +58,7 @@ using the camera.
|
||||||
|
|
||||||
- It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.
|
- It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.
|
||||||
|
|
||||||
- It is recommended to use it ONLY if you are going to create 3D effects. For 2D effecs, use the action CCFollow or position/scale/rotate.
|
- It is recommended to use it ONLY if you are going to create 3D effects. For 2D effects, use the action CCFollow or position/scale/rotate.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class CC_DLL CCCamera : public CCObject
|
class CC_DLL CCCamera : public CCObject
|
||||||
|
|
|
@ -70,7 +70,7 @@ using namespace std;
|
||||||
unsigned int g_uNumberOfDraws = 0;
|
unsigned int g_uNumberOfDraws = 0;
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
// XXX it shoul be a Director ivar. Move it there once support for multiple directors is added
|
// XXX it should be a Director ivar. Move it there once support for multiple directors is added
|
||||||
|
|
||||||
// singleton stuff
|
// singleton stuff
|
||||||
static CCDisplayLinkDirector s_SharedDirector;
|
static CCDisplayLinkDirector s_SharedDirector;
|
||||||
|
@ -814,7 +814,7 @@ bool CCDirector::enableRetinaDisplay(bool enabled)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Already diabled?
|
// Already disabled?
|
||||||
if (!enabled && m_fContentScaleFactor == 1)
|
if (!enabled && m_fContentScaleFactor == 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -58,7 +58,7 @@ typedef enum {
|
||||||
/// it calls "updateProjection" on the projection delegate.
|
/// it calls "updateProjection" on the projection delegate.
|
||||||
kCCDirectorProjectionCustom,
|
kCCDirectorProjectionCustom,
|
||||||
|
|
||||||
/// Detault projection is 3D projection
|
/// Default projection is 3D projection
|
||||||
kCCDirectorProjectionDefault = kCCDirectorProjection3D,
|
kCCDirectorProjectionDefault = kCCDirectorProjection3D,
|
||||||
} ccDirectorProjection;
|
} ccDirectorProjection;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ static void lazy_init( void )
|
||||||
if( ! s_bInitialized ) {
|
if( ! s_bInitialized ) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Position and 1 color passed as a uniform (to similate glColor4ub )
|
// Position and 1 color passed as a uniform (to simulate glColor4ub )
|
||||||
//
|
//
|
||||||
s_pShader = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_Position_uColor);
|
s_pShader = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_Position_uColor);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ static void lazy_init( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When back to foreground on android, we want to it to inilialize again
|
// When switching from backround to foreground on android, we want the params to be initialized again
|
||||||
void ccDrawInit()
|
void ccDrawInit()
|
||||||
{
|
{
|
||||||
s_bInitialized = false;
|
s_bInitialized = false;
|
||||||
|
|
|
@ -56,7 +56,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
class CCPointArray;
|
class CCPointArray;
|
||||||
|
|
||||||
/** initlialize context */
|
/** initialize context */
|
||||||
void CC_DLL ccDrawInit();
|
void CC_DLL ccDrawInit();
|
||||||
|
|
||||||
/** draws a point given x and y coordinate measured in points */
|
/** draws a point given x and y coordinate measured in points */
|
||||||
|
@ -78,12 +78,12 @@ void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination );
|
||||||
*/
|
*/
|
||||||
void CC_DLL ccDrawSolidRect( CCPoint origin, CCPoint destination, ccColor4F color );
|
void CC_DLL ccDrawSolidRect( CCPoint origin, CCPoint destination, ccColor4F color );
|
||||||
|
|
||||||
/** draws a poligon given a pointer to CCPoint coordiantes and the number of vertices measured in points.
|
/** draws a polygon given a pointer to CCPoint coordinates and the number of vertices measured in points.
|
||||||
The polygon can be closed or open
|
The polygon can be closed or open
|
||||||
*/
|
*/
|
||||||
void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices, bool closePolygon );
|
void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices, bool closePolygon );
|
||||||
|
|
||||||
/** draws a solid polygon given a pointer to CGPoint coordiantes, the number of vertices measured in points, and a color.
|
/** draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color.
|
||||||
*/
|
*/
|
||||||
void CC_DLL ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color );
|
void CC_DLL ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color );
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ void CCScheduler::priorityIn(tListEntry **ppList, CCObject *pTarget, int nPriori
|
||||||
pListElement->next = pListElement->prev = NULL;
|
pListElement->next = pListElement->prev = NULL;
|
||||||
pListElement->markedForDeletion = false;
|
pListElement->markedForDeletion = false;
|
||||||
|
|
||||||
// empey list ?
|
// empty list ?
|
||||||
if (! *ppList)
|
if (! *ppList)
|
||||||
{
|
{
|
||||||
DL_APPEND(*ppList, pListElement);
|
DL_APPEND(*ppList, pListElement);
|
||||||
|
@ -763,7 +763,7 @@ void CCScheduler::update(float dt)
|
||||||
dt *= m_fTimeScale;
|
dt *= m_fTimeScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate all over the Updates selectors
|
// Iterate over all the Updates' selectors
|
||||||
tListEntry *pEntry, *pTmp;
|
tListEntry *pEntry, *pTmp;
|
||||||
|
|
||||||
// updates with priority < 0
|
// updates with priority < 0
|
||||||
|
@ -799,7 +799,7 @@ void CCScheduler::update(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interate all over the custom selectors
|
// Iterate over all the custom selectors
|
||||||
for (tHashSelectorEntry *elt = m_pHashForSelectors; elt != NULL; )
|
for (tHashSelectorEntry *elt = m_pHashForSelectors; elt != NULL; )
|
||||||
{
|
{
|
||||||
m_pCurrentTarget = elt;
|
m_pCurrentTarget = elt;
|
||||||
|
@ -838,7 +838,7 @@ void CCScheduler::update(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interate all over the script callbacks
|
// Iterate over all the script callbacks
|
||||||
if (m_pScriptHandlerEntries)
|
if (m_pScriptHandlerEntries)
|
||||||
{
|
{
|
||||||
for (int i = m_pScriptHandlerEntries->count() - 1; i >= 0; i--)
|
for (int i = m_pScriptHandlerEntries->count() - 1; i >= 0; i--)
|
||||||
|
@ -855,7 +855,7 @@ void CCScheduler::update(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete all updates that are morked for deletion
|
// delete all updates that are marked for deletion
|
||||||
// updates with priority < 0
|
// updates with priority < 0
|
||||||
DL_FOREACH_SAFE(m_pUpdatesNegList, pEntry, pTmp)
|
DL_FOREACH_SAFE(m_pUpdatesNegList, pEntry, pTmp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CCSet;
|
||||||
//
|
//
|
||||||
// CCTimer
|
// CCTimer
|
||||||
//
|
//
|
||||||
/** @brief Light weight timer */
|
/** @brief Light-weight timer */
|
||||||
class CC_DLL CCTimer : public CCObject
|
class CC_DLL CCTimer : public CCObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -108,7 +108,7 @@ struct _hashUpdateEntry;
|
||||||
|
|
||||||
class CCArray;
|
class CCArray;
|
||||||
|
|
||||||
/** @brief Scheduler is responsible of triggering the scheduled callbacks.
|
/** @brief Scheduler is responsible for triggering the scheduled callbacks.
|
||||||
You should not use NSTimer. Instead use this class.
|
You should not use NSTimer. Instead use this class.
|
||||||
|
|
||||||
There are 2 different types of callbacks (selectors):
|
There are 2 different types of callbacks (selectors):
|
||||||
|
@ -142,9 +142,9 @@ public:
|
||||||
|
|
||||||
/** The scheduled method will be called every 'interval' seconds.
|
/** The scheduled method will be called every 'interval' seconds.
|
||||||
If paused is YES, then it won't be called until it is resumed.
|
If paused is YES, then it won't be called until it is resumed.
|
||||||
If 'interval' is 0, it will be called every frame, but if so, it recommened to use 'scheduleUpdateForTarget:' instead.
|
If 'interval' is 0, it will be called every frame, but if so, it's recommended to use 'scheduleUpdateForTarget:' instead.
|
||||||
If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
|
If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
|
||||||
repeat let the action be repeated repeat + 1 times, use kCCRepeatForever to let the action run continiously
|
repeat let the action be repeated repeat + 1 times, use kCCRepeatForever to let the action run continuously
|
||||||
delay is the amount of time the action will wait before it'll start
|
delay is the amount of time the action will wait before it'll start
|
||||||
|
|
||||||
@since v0.99.3, repeat and delay added in v1.1
|
@since v0.99.3, repeat and delay added in v1.1
|
||||||
|
|
|
@ -234,7 +234,7 @@ public:
|
||||||
public:
|
public:
|
||||||
/** creates the action with a set boundary,
|
/** creates the action with a set boundary,
|
||||||
It will work with no boundary if @param rect is equal to CCRectZero.
|
It will work with no boundary if @param rect is equal to CCRectZero.
|
||||||
@deprecated: Please use create(CCNode*, const CCRect&) intead. This interface will be deprecated sooner or later.
|
@deprecated: Please use create(CCNode*, const CCRect&) instead. This interface will be deprecated sooner or later.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
|
CC_DEPRECATED_ATTRIBUTE static CCFollow* actionWithTarget(CCNode *pFollowedNode, const CCRect& rect = CCRectZero);
|
||||||
/** creates the action with a set boundary,
|
/** creates the action with a set boundary,
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
|
* Original code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
|
||||||
*
|
*
|
||||||
* Adapted to cocos2d-x by Vit Valentin
|
* Adapted to cocos2d-x by Vit Valentin
|
||||||
*
|
*
|
||||||
|
@ -96,12 +96,12 @@ CCPointArray::CCPointArray() :m_pControlPoints(NULL){}
|
||||||
|
|
||||||
void CCPointArray::addControlPoint(CCPoint controlPoint)
|
void CCPointArray::addControlPoint(CCPoint controlPoint)
|
||||||
{
|
{
|
||||||
// should create a new object of CCPoint
|
// should create a new object: CCPoint
|
||||||
// because developer always use this function like this
|
// because developers are accustomed to using
|
||||||
// addControlPoint(ccp(x, y))
|
// addControlPoint(ccp(x, y))
|
||||||
// passing controlPoint is a temple object
|
// which assumes controlPoint is a temporary struct
|
||||||
// and CCArray::addObject() will retain the passing object, so it
|
// but CCArray::addObject() will retain the passed object, so temp
|
||||||
// should be an object created in heap
|
// should be an object created in the heap.
|
||||||
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
||||||
m_pControlPoints->addObject(temp);
|
m_pControlPoints->addObject(temp);
|
||||||
temp->release();
|
temp->release();
|
||||||
|
@ -109,12 +109,12 @@ void CCPointArray::addControlPoint(CCPoint controlPoint)
|
||||||
|
|
||||||
void CCPointArray::insertControlPoint(CCPoint &controlPoint, unsigned int index)
|
void CCPointArray::insertControlPoint(CCPoint &controlPoint, unsigned int index)
|
||||||
{
|
{
|
||||||
// should create a new object of CCPoint
|
// should create a new object: CCPoint
|
||||||
// because developer always use this function like this
|
// because developers are accustomed to using
|
||||||
// insertControlPoint(ccp(x, y))
|
// insertControlPoint(ccp(x, y))
|
||||||
// passing controlPoint is a temple object
|
// which assumes controlPoint is a temporary struct
|
||||||
// and CCArray::insertObject() will retain the passing object, so it
|
// but CCArray::insertObject() will retain the passed object, so temp
|
||||||
// should be an object created in heap
|
// should be an object created in the heap.
|
||||||
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
||||||
m_pControlPoints->insertObject(temp, index);
|
m_pControlPoints->insertObject(temp, index);
|
||||||
temp->release();
|
temp->release();
|
||||||
|
@ -130,12 +130,12 @@ CCPoint CCPointArray::getControlPointAtIndex(unsigned int index)
|
||||||
|
|
||||||
void CCPointArray::replaceControlPoint(cocos2d::CCPoint &controlPoint, unsigned int index)
|
void CCPointArray::replaceControlPoint(cocos2d::CCPoint &controlPoint, unsigned int index)
|
||||||
{
|
{
|
||||||
// should create a new object of CCPoint
|
// should create a new object: CCPoint
|
||||||
// because developer always use this function like this
|
// because developers are accustomed to using
|
||||||
// replaceControlPoint(ccp(x, y))
|
// replaceControlPoint(ccp(x, y))
|
||||||
// passing controlPoint is a temple object
|
// which assumes controlPoint is a temporary struct
|
||||||
// and CCArray::insertObject() will retain the passing object, so it
|
// but CCArray::insertObject() will retain the passed object, so temp
|
||||||
// should be an object created in heap
|
// should be an object created in the heap.
|
||||||
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
CCPoint *temp = new CCPoint(controlPoint.x, controlPoint.y);
|
||||||
m_pControlPoints->replaceObjectAtIndex(index, temp);
|
m_pControlPoints->replaceObjectAtIndex(index, temp);
|
||||||
temp->release();
|
temp->release();
|
||||||
|
|
|
@ -53,7 +53,7 @@ void CC_DLL CCLuaLog(const char * pszFormat);
|
||||||
void CC_DLL CCMessageBox(const char * pszMsg, const char * pszTitle);
|
void CC_DLL CCMessageBox(const char * pszMsg, const char * pszTitle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Enum the language type supportted now
|
@brief Enum the language type supported now
|
||||||
*/
|
*/
|
||||||
typedef enum LanguageType
|
typedef enum LanguageType
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,7 +91,7 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height, Resol
|
||||||
|
|
||||||
//setViewPortInPoints(0, 0,m_obScreenSize.width, m_obScreenSize.height);
|
//setViewPortInPoints(0, 0,m_obScreenSize.width, m_obScreenSize.height);
|
||||||
|
|
||||||
// reset director's member vaviables to fit visible rect
|
// reset director's member variables to fit visible rect
|
||||||
CCDirector::sharedDirector()->createStatsLabel();
|
CCDirector::sharedDirector()->createStatsLabel();
|
||||||
CCDirector::sharedDirector()->m_obWinSizeInPoints = CCDirector::sharedDirector()->m_obWinSizeInPixels = getSize();
|
CCDirector::sharedDirector()->m_obWinSizeInPoints = CCDirector::sharedDirector()->m_obWinSizeInPixels = getSize();
|
||||||
CCDirector::sharedDirector()->setGLDefaultValues();
|
CCDirector::sharedDirector()->setGLDefaultValues();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
CCEGLViewProtocol();
|
CCEGLViewProtocol();
|
||||||
virtual ~CCEGLViewProtocol();
|
virtual ~CCEGLViewProtocol();
|
||||||
|
|
||||||
/** Force destorying EGL view, subclass must implement this method. */
|
/** Force destroying EGL view, subclass must implement this method. */
|
||||||
virtual void end() = 0;
|
virtual void end() = 0;
|
||||||
|
|
||||||
/** Get whether opengl render system is ready, subclass must implement this method. */
|
/** Get whether opengl render system is ready, subclass must implement this method. */
|
||||||
|
|
|
@ -199,7 +199,7 @@ public:
|
||||||
}
|
}
|
||||||
else if (preState == SAX_ARRAY)
|
else if (preState == SAX_ARRAY)
|
||||||
{
|
{
|
||||||
CCAssert(! m_tArrayStack.empty(), "The state is worng!");
|
CCAssert(! m_tArrayStack.empty(), "The state is wrong!");
|
||||||
CCArray* pPreArray = m_tArrayStack.top();
|
CCArray* pPreArray = m_tArrayStack.top();
|
||||||
pPreArray->addObject(m_pArray);
|
pPreArray->addObject(m_pArray);
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ public:
|
||||||
{
|
{
|
||||||
if (curState == SAX_DICT)
|
if (curState == SAX_DICT)
|
||||||
{
|
{
|
||||||
CCAssert(!m_sCurKey.empty(), "not found key : <integet/real>");
|
CCAssert(!m_sCurKey.empty(), "key not found : <integer/real>");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sCurValue.append(pText->getCString());
|
m_sCurValue.append(pText->getCString());
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
bool initWithImageFile(const char * strPath, EImageFormat imageType = kFmtPng);
|
bool initWithImageFile(const char * strPath, EImageFormat imageType = kFmtPng);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@brief The same meaning as initWithImageFile, but it is thread safe. It is casued by
|
@brief The same result as with initWithImageFile, but thread safe. It is caused by
|
||||||
loadImage() in CCTextureCache.cpp.
|
loadImage() in CCTextureCache.cpp.
|
||||||
@param fullpath full path of the file.
|
@param fullpath full path of the file.
|
||||||
@param imageType the type of image, currently only supporting two types.
|
@param imageType the type of image, currently only supporting two types.
|
||||||
|
@ -120,7 +120,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Save CCImage data to the specified file, with specified format.
|
@brief Save CCImage data to the specified file, with specified format.
|
||||||
@param pszFilePath the file's absolute path, including file subfix.
|
@param pszFilePath the file's absolute path, including file suffix.
|
||||||
@param bIsToRGB whether the image is saved as RGB format.
|
@param bIsToRGB whether the image is saved as RGB format.
|
||||||
*/
|
*/
|
||||||
bool saveToFile(const char *pszFilePath, bool bIsToRGB = true);
|
bool saveToFile(const char *pszFilePath, bool bIsToRGB = true);
|
||||||
|
|
|
@ -40,7 +40,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
// premultiply alpha, or the effect will wrong when want to use other pixel format in CCTexture2D,
|
// premultiply alpha, or the effect will wrong when want to use other pixel format in CCTexture2D,
|
||||||
// such as RGB888, RGB5A1
|
// such as RGB888, RGB5A1
|
||||||
#define CC_RGB_PREMULTIPLY_APLHA(vr, vg, vb, va) \
|
#define CC_RGB_PREMULTIPLY_ALPHA(vr, vg, vb, va) \
|
||||||
(unsigned)(((unsigned)((unsigned char)(vr) * ((unsigned char)(va) + 1)) >> 8) | \
|
(unsigned)(((unsigned)((unsigned char)(vr) * ((unsigned char)(va) + 1)) >> 8) | \
|
||||||
((unsigned)((unsigned char)(vg) * ((unsigned char)(va) + 1) >> 8) << 8) | \
|
((unsigned)((unsigned char)(vg) * ((unsigned char)(va) + 1) >> 8) << 8) | \
|
||||||
((unsigned)((unsigned char)(vb) * ((unsigned char)(va) + 1) >> 8) << 16) | \
|
((unsigned)((unsigned char)(vb) * ((unsigned char)(va) + 1) >> 8) << 16) | \
|
||||||
|
@ -71,7 +71,7 @@ static void pngReadCallback(png_structp png_ptr, png_bytep data, png_size_t leng
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Impliment CCImage
|
// Implement CCImage
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
CCImage::CCImage()
|
CCImage::CCImage()
|
||||||
|
@ -325,7 +325,7 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen)
|
||||||
{
|
{
|
||||||
png_set_palette_to_rgb(png_ptr);
|
png_set_palette_to_rgb(png_ptr);
|
||||||
}
|
}
|
||||||
// low-bit-depth grayscale iamges are to be expanded to 8 bits
|
// low-bit-depth grayscale images are to be expanded to 8 bits
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && m_nBitsPerComponent < 8)
|
if (color_type == PNG_COLOR_TYPE_GRAY && m_nBitsPerComponent < 8)
|
||||||
{
|
{
|
||||||
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||||
|
@ -376,7 +376,7 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen)
|
||||||
{
|
{
|
||||||
for(unsigned int j = 0; j < rowbytes; j += 4)
|
for(unsigned int j = 0; j < rowbytes; j += 4)
|
||||||
{
|
{
|
||||||
*tmp++ = CC_RGB_PREMULTIPLY_APLHA( row_pointers[i][j], row_pointers[i][j + 1],
|
*tmp++ = CC_RGB_PREMULTIPLY_ALPHA( row_pointers[i][j], row_pointers[i][j + 1],
|
||||||
row_pointers[i][j + 2], row_pointers[i][j + 3] );
|
row_pointers[i][j + 2], row_pointers[i][j + 3] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ bool CCImage::_initWithTiffData(void* pData, int nDataLen)
|
||||||
after invoking TIFFReadRGBAImageOriented
|
after invoking TIFFReadRGBAImageOriented
|
||||||
for(int j = 0; j < m_nWidth * m_nHeight * 4; j += 4)
|
for(int j = 0; j < m_nWidth * m_nHeight * 4; j += 4)
|
||||||
{
|
{
|
||||||
*tmp++ = CC_RGB_PREMULTIPLY_APLHA( src[j], src[j + 1],
|
*tmp++ = CC_RGB_PREMULTIPLY_ALPHA( src[j], src[j + 1],
|
||||||
src[j + 2], src[j + 3] );
|
src[j + 2], src[j + 3] );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -585,7 +585,7 @@ bool CCImage::_initWithRawData(void * pData, int nDatalen, int nWidth, int nHeig
|
||||||
m_nWidth = (short)nWidth;
|
m_nWidth = (short)nWidth;
|
||||||
m_bHasAlpha = true;
|
m_bHasAlpha = true;
|
||||||
|
|
||||||
// only RGBA8888 surported
|
// only RGBA8888 supported
|
||||||
int nBytesPerComponent = 4;
|
int nBytesPerComponent = 4;
|
||||||
int nSize = nHeight * nWidth * nBytesPerComponent;
|
int nSize = nHeight * nWidth * nBytesPerComponent;
|
||||||
m_pData = new unsigned char[nSize];
|
m_pData = new unsigned char[nSize];
|
||||||
|
|
|
@ -44,7 +44,7 @@ Config of cocos2d-x project, per target platform.
|
||||||
#define CC_PLATFORM_BLACKBERRY 7
|
#define CC_PLATFORM_BLACKBERRY 7
|
||||||
#define CC_PLATFORM_MAC 8
|
#define CC_PLATFORM_MAC 8
|
||||||
|
|
||||||
// Determine tartet platform by compile environment macro.
|
// Determine target platform by compile environment macro.
|
||||||
#define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN
|
#define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN
|
||||||
|
|
||||||
// iphone
|
// iphone
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool CCSAXParser::init(const char *pszEncoding)
|
||||||
bool CCSAXParser::parse(const char* pXMLData, unsigned int uDataLength)
|
bool CCSAXParser::parse(const char* pXMLData, unsigned int uDataLength)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* this initialize the library and check potential ABI mismatches
|
* this initializes the library and checks potential ABI mismatches
|
||||||
* between the version it was compiled for and the actual shared
|
* between the version it was compiled for and the actual shared
|
||||||
* library used.
|
* library used.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,8 +24,8 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include "CCThread.h"
|
#include "CCThread.h"
|
||||||
|
|
||||||
// iOS already has a CCThread.mm
|
// iOS and Mac already has a CCThread.mm
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS && CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ public:
|
||||||
virtual ~CCApplication();
|
virtual ~CCApplication();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Callback by CCDirector for limit FPS.
|
@brief Callback by CCDirector to limit FPS.
|
||||||
@interval The time, which expressed in second in second, between current frame and next.
|
@interval The time, expressed in seconds, between current frame and next.
|
||||||
*/
|
*/
|
||||||
void setAnimationInterval(double interval);
|
void setAnimationInterval(double interval);
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ public:
|
||||||
} Orientation;
|
} Orientation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Callback by CCDirector for change device orientation.
|
@brief Callback by CCDirector to change device orientation.
|
||||||
@orientation The defination of orientation which CCDirector want change to.
|
@orientation The desired orientation.
|
||||||
@return The actual orientation of the application.
|
@return The actual orientation of the application.
|
||||||
*/
|
*/
|
||||||
Orientation setOrientation(Orientation orientation);
|
Orientation setOrientation(Orientation orientation);
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
int run();
|
int run();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Get current applicaiton instance.
|
@brief Get current application instance.
|
||||||
@return Current application instance pointer.
|
@return Current application instance pointer.
|
||||||
*/
|
*/
|
||||||
static CCApplication* sharedApplication();
|
static CCApplication* sharedApplication();
|
||||||
|
|
|
@ -41,7 +41,7 @@ THE SOFTWARE.
|
||||||
// normal process
|
// normal process
|
||||||
#include <GLES2/gl2.h>
|
#include <GLES2/gl2.h>
|
||||||
#include <GLES2/gl2ext.h>
|
#include <GLES2/gl2ext.h>
|
||||||
// gl2.h don't define GLchar on Android
|
// gl2.h doesn't define GLchar on Android
|
||||||
typedef char GLchar;
|
typedef char GLchar;
|
||||||
|
|
||||||
//declare here while define in CCEGLView_android.cpp
|
//declare here while define in CCEGLView_android.cpp
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
* this method call Cococs2dx.createBitmap()(java code) to create the bitmap, the java code
|
* this method call Cococs2dx.createBitmap()(java code) to create the bitmap, the java code
|
||||||
* will call Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC() to init the width, height
|
* will call Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC() to init the width, height
|
||||||
* and data.
|
* and data.
|
||||||
* use this appoach to decrease the jni call number
|
* use this approach to decrease the jni call number
|
||||||
*/
|
*/
|
||||||
jstring jstrText = methodInfo.env->NewStringUTF(text);
|
jstring jstrText = methodInfo.env->NewStringUTF(text);
|
||||||
jstring jstrFont = methodInfo.env->NewStringUTF(pFontName);
|
jstring jstrFont = methodInfo.env->NewStringUTF(pFontName);
|
||||||
|
|
|
@ -66,7 +66,7 @@ static id s_sharedDirectorCaller;
|
||||||
|
|
||||||
-(void) startMainLoop
|
-(void) startMainLoop
|
||||||
{
|
{
|
||||||
// CCDirector::setAnimationInterval() is called, we should invalide it first
|
// CCDirector::setAnimationInterval() is called, we should invalidate it first
|
||||||
[displayLink invalidate];
|
[displayLink invalidate];
|
||||||
displayLink = nil;
|
displayLink = nil;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ static id s_sharedDirectorCaller;
|
||||||
|
|
||||||
-(void) setAnimationInterval:(double)intervalNew
|
-(void) setAnimationInterval:(double)intervalNew
|
||||||
{
|
{
|
||||||
// CCDirector::setAnimationInterval() is called, we should invalide it first
|
// CCDirector::setAnimationInterval() is called, we should invalidate it first
|
||||||
[displayLink invalidate];
|
[displayLink invalidate];
|
||||||
displayLink = nil;
|
displayLink = nil;
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ CCArray* ccFileUtils_arrayWithContentsOfFileThreadSafe(const char* pFileName)
|
||||||
unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize)
|
unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize)
|
||||||
{
|
{
|
||||||
unsigned char * pBuffer = NULL;
|
unsigned char * pBuffer = NULL;
|
||||||
CCAssert(pszFileName != NULL && pSize != NULL && pszMode != NULL, "Invaild parameters.");
|
CCAssert(pszFileName != NULL && pSize != NULL && pszMode != NULL, "Invalid parameters.");
|
||||||
*pSize = 0;
|
*pSize = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
|
@ -437,7 +437,7 @@ bool CCImage::_initWithRawData(void *pData, int nDatalen, int nWidth, int nHeigh
|
||||||
m_nWidth = (short)nWidth;
|
m_nWidth = (short)nWidth;
|
||||||
m_bHasAlpha = true;
|
m_bHasAlpha = true;
|
||||||
|
|
||||||
// only RGBA8888 surported
|
// only RGBA8888 supported
|
||||||
int nBytesPerComponent = 4;
|
int nBytesPerComponent = 4;
|
||||||
int nSize = nHeight * nWidth * nBytesPerComponent;
|
int nSize = nHeight * nWidth * nBytesPerComponent;
|
||||||
m_pData = new unsigned char[nSize];
|
m_pData = new unsigned char[nSize];
|
||||||
|
|
|
@ -577,7 +577,7 @@ static EAGLView *view = 0;
|
||||||
/* If text can be selected, it can be marked. Marked text represents provisionally
|
/* If text can be selected, it can be marked. Marked text represents provisionally
|
||||||
* inserted text that has yet to be confirmed by the user. It requires unique visual
|
* inserted text that has yet to be confirmed by the user. It requires unique visual
|
||||||
* treatment in its display. If there is any marked text, the selection, whether a
|
* treatment in its display. If there is any marked text, the selection, whether a
|
||||||
* caret or an extended range, always resides witihin.
|
* caret or an extended range, always resides within.
|
||||||
*
|
*
|
||||||
* Setting marked text either replaces the existing marked text or, if none is present,
|
* Setting marked text either replaces the existing marked text or, if none is present,
|
||||||
* inserts it from the current selection. */
|
* inserts it from the current selection. */
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
|
|
||||||
- (ZAttributedString *)attributedSubstringFromRange:(NSRange)aRange {
|
- (ZAttributedString *)attributedSubstringFromRange:(NSRange)aRange {
|
||||||
if (NSMaxRange(aRange) > [_buffer length]) {
|
if (NSMaxRange(aRange) > [_buffer length]) {
|
||||||
@throw [NSException exceptionWithName:NSRangeException reason:@"range was outisde of the attributed string" userInfo:nil];
|
@throw [NSException exceptionWithName:NSRangeException reason:@"range was outside of the attributed string" userInfo:nil];
|
||||||
}
|
}
|
||||||
ZMutableAttributedString *newStr = [self mutableCopy];
|
ZMutableAttributedString *newStr = [self mutableCopy];
|
||||||
if (aRange.location > 0) {
|
if (aRange.location > 0) {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// override UIAccelerometer behaviour
|
// override UIAccelerometer behavior
|
||||||
@interface UIAccelerometer (Simulation)
|
@interface UIAccelerometer (Simulation)
|
||||||
+ (UIAccelerometer *)sharedAccelerometer;
|
+ (UIAccelerometer *)sharedAccelerometer;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -167,7 +167,7 @@ static AccelerometerSimulation *sharedAccelerometer = NULL;
|
||||||
accObject = [UIAccelerationSimulation alloc];
|
accObject = [UIAccelerationSimulation alloc];
|
||||||
isExiting = false;
|
isExiting = false;
|
||||||
|
|
||||||
// couldn't get the CFSocket version to work with UDP and runloop, so used Berkely sockets and a thread instead
|
// couldn't get the CFSocket version to work with UDP and runloop, so used Berkeley sockets and a thread instead
|
||||||
|
|
||||||
udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
|
|
|
@ -453,7 +453,7 @@ void CCTMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tileset->m_sSourceImage = m_sResources + "/" + imagename;
|
tileset->m_sSourceImage = m_sResources + (m_sResources.size() ? "/" : "") + imagename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(elementName == "data")
|
else if(elementName == "data")
|
||||||
|
|
Loading…
Reference in New Issue