diff --git a/cocos2dx/CCConfiguration.h b/cocos2dx/CCConfiguration.h index 299aef6772..5064765dbb 100644 --- a/cocos2dx/CCConfiguration.h +++ b/cocos2dx/CCConfiguration.h @@ -97,8 +97,8 @@ public: return m_bSupportsDiscardFramebuffer; } - /** Whether or not shareable VAOs are supported. - @since v2.0.0 + /** Whether or not shareable VAOs are supported. + @since v2.0.0 */ inline bool isSupportsShareableVAO(void) { diff --git a/cocos2dx/CCDrawingPrimitives.h b/cocos2dx/CCDrawingPrimitives.h index a57b503ef1..71883bae07 100644 --- a/cocos2dx/CCDrawingPrimitives.h +++ b/cocos2dx/CCDrawingPrimitives.h @@ -65,12 +65,12 @@ void CC_DLL ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints ); /** draws a line given the origin and destination point measured in points */ void CC_DLL ccDrawLine( const CCPoint& origin, const CCPoint& destination ); -/** draws a rectangle given the origin and destination point measured in points. */ -void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination ); - -/** draws a solid rectangle given the origin and destination point measured in points. - @since 1.1 - */ +/** draws a rectangle given the origin and destination point measured in points. */ +void CC_DLL ccDrawRect( CCPoint origin, CCPoint destination ); + +/** draws a solid rectangle given the origin and destination point measured in points. + @since 1.1 + */ 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. @@ -97,16 +97,16 @@ void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, cons */ void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments); -/** draws a Catmull Rom path. - @warning This function could be pretty slow. Use it only for debugging purposes. - @since v2.0 - */ -void CC_DLL ccDrawCatmullRom( CCPointArray *arrayOfControlPoints, unsigned int segments ); - -/** draws a Cardinal Spline path. - @warning This function could be pretty slow. Use it only for debugging purposes. - @since v2.0 - */ +/** draws a Catmull Rom path. + @warning This function could be pretty slow. Use it only for debugging purposes. + @since v2.0 + */ +void CC_DLL ccDrawCatmullRom( CCPointArray *arrayOfControlPoints, unsigned int segments ); + +/** draws a Cardinal Spline path. + @warning This function could be pretty slow. Use it only for debugging purposes. + @since v2.0 + */ void CC_DLL ccDrawCardinalSpline( CCPointArray *config, CCFloat tension, unsigned int segments ); /** set the drawing color with 4 unsigned bytes diff --git a/cocos2dx/CCScheduler.cpp b/cocos2dx/CCScheduler.cpp index 1f486f6e89..75c22b6dc3 100644 --- a/cocos2dx/CCScheduler.cpp +++ b/cocos2dx/CCScheduler.cpp @@ -514,7 +514,7 @@ void CCScheduler::unscheduleAllSelectors(void) unscheduleAllSelectorsWithMinPriority(kCCPrioritySystem); } -void CCScheduler::unscheduleAllSelectorsWithMinPriority(int nMinPriority) +void CCScheduler::unscheduleAllSelectorsWithMinPriority(int nMinPriority) { // Custom Selectors tHashSelectorEntry *pElement = NULL; @@ -682,66 +682,66 @@ bool CCScheduler::isTargetPaused(CCObject *pTarget) return false; // should never get here } -CCSet* CCScheduler::pauseAllTargets() -{ - return pauseAllTargetsWithMinPriority(kCCPrioritySystem); -} - -CCSet* CCScheduler::pauseAllTargetsWithMinPriority(int nMinPriority) -{ - CCSet* idsWithSelectors = new CCSet();// setWithCapacity:50]; - idsWithSelectors->autorelease(); - - // Custom Selectors - for(tHashSelectorEntry *element = m_pHashForSelectors; element != NULL; - element = (tHashSelectorEntry*)element->hh.next) - { - element->paused = true; - idsWithSelectors->addObject(element->target); - } - - // Updates selectors - tListEntry *entry, *tmp; - if(nMinPriority < 0) - { - DL_FOREACH_SAFE( m_pUpdatesNegList, entry, tmp ) - { - if(entry->priority >= nMinPriority) - { - entry->paused = true; - idsWithSelectors->addObject(entry->target); - } - } - } - - if(nMinPriority <= 0) - { - DL_FOREACH_SAFE( m_pUpdates0List, entry, tmp ) - { - entry->paused = true; - idsWithSelectors->addObject(entry->target); - } - } - - DL_FOREACH_SAFE( m_pUpdatesPosList, entry, tmp ) - { - if(entry->priority >= nMinPriority) - { - entry->paused = true; - idsWithSelectors->addObject(entry->target); - } - } - - return idsWithSelectors; -} - -void CCScheduler::resumeTargets(CCSet* pTargetsToResume) -{ - CCSetIterator iter; +CCSet* CCScheduler::pauseAllTargets() +{ + return pauseAllTargetsWithMinPriority(kCCPrioritySystem); +} + +CCSet* CCScheduler::pauseAllTargetsWithMinPriority(int nMinPriority) +{ + CCSet* idsWithSelectors = new CCSet();// setWithCapacity:50]; + idsWithSelectors->autorelease(); + + // Custom Selectors + for(tHashSelectorEntry *element = m_pHashForSelectors; element != NULL; + element = (tHashSelectorEntry*)element->hh.next) + { + element->paused = true; + idsWithSelectors->addObject(element->target); + } + + // Updates selectors + tListEntry *entry, *tmp; + if(nMinPriority < 0) + { + DL_FOREACH_SAFE( m_pUpdatesNegList, entry, tmp ) + { + if(entry->priority >= nMinPriority) + { + entry->paused = true; + idsWithSelectors->addObject(entry->target); + } + } + } + + if(nMinPriority <= 0) + { + DL_FOREACH_SAFE( m_pUpdates0List, entry, tmp ) + { + entry->paused = true; + idsWithSelectors->addObject(entry->target); + } + } + + DL_FOREACH_SAFE( m_pUpdatesPosList, entry, tmp ) + { + if(entry->priority >= nMinPriority) + { + entry->paused = true; + idsWithSelectors->addObject(entry->target); + } + } + + return idsWithSelectors; +} + +void CCScheduler::resumeTargets(CCSet* pTargetsToResume) +{ + CCSetIterator iter; for (iter = pTargetsToResume->begin(); iter != pTargetsToResume->end(); ++iter) { resumeTarget(*iter); - } + } } // main loop diff --git a/cocos2dx/CCScheduler.h b/cocos2dx/CCScheduler.h index 5ae548f980..c41487b4ad 100644 --- a/cocos2dx/CCScheduler.h +++ b/cocos2dx/CCScheduler.h @@ -176,10 +176,10 @@ public: */ void unscheduleAllSelectors(void); - /** Unschedules all selectors from all targets with a minimum priority. - You should only call this with kCCPriorityNonSystemMin or higher. - @since v2.0.0 - */ + /** Unschedules all selectors from all targets with a minimum priority. + You should only call this with kCCPriorityNonSystemMin or higher. + @since v2.0.0 + */ void unscheduleAllSelectorsWithMinPriority(int nMinPriority); /** The scheduled script callback will be called every 'interval' seconds. @@ -211,22 +211,22 @@ public: */ bool isTargetPaused(CCObject *pTarget); - /** Pause all selectors from all targets. - You should NEVER call this method, unless you know what you are doing. - @since v2.0.0 - */ - CCSet* pauseAllTargets(); - - /** Pause all selectors from all targets with a minimum priority. - You should only call this with kCCPriorityNonSystemMin or higher. - @since v2.0.0 - */ - CCSet* pauseAllTargetsWithMinPriority(int nMinPriority); - - /** Resume selectors on a set of targets. - This can be useful for undoing a call to pauseAllSelectors. - @since v2.0.0 - */ + /** Pause all selectors from all targets. + You should NEVER call this method, unless you know what you are doing. + @since v2.0.0 + */ + CCSet* pauseAllTargets(); + + /** Pause all selectors from all targets with a minimum priority. + You should only call this with kCCPriorityNonSystemMin or higher. + @since v2.0.0 + */ + CCSet* pauseAllTargetsWithMinPriority(int nMinPriority); + + /** Resume selectors on a set of targets. + This can be useful for undoing a call to pauseAllSelectors. + @since v2.0.0 + */ void resumeTargets(CCSet* targetsToResume); private: diff --git a/cocos2dx/cocoa/CCArray.cpp b/cocos2dx/cocoa/CCArray.cpp index 63ffff4f86..204da85f0e 100644 --- a/cocos2dx/cocoa/CCArray.cpp +++ b/cocos2dx/cocoa/CCArray.cpp @@ -253,16 +253,16 @@ bool CCArray::containsObject(CCObject* object) return ccArrayContainsObject(data, object); } -bool CCArray::isEqualToArray(CCArray* otherArray) -{ - for (unsigned int i = 0; i< this->count(); i++) - { - if (!this->objectAtIndex(i)->isEqual(otherArray->objectAtIndex(i))) - { - return false; - } - } - return true; +bool CCArray::isEqualToArray(CCArray* otherArray) +{ + for (unsigned int i = 0; i< this->count(); i++) + { + if (!this->objectAtIndex(i)->isEqual(otherArray->objectAtIndex(i))) + { + return false; + } + } + return true; } void CCArray::addObject(CCObject* object) @@ -338,10 +338,10 @@ void CCArray::exchangeObjectAtIndex(unsigned int index1, unsigned int index2) ccArraySwapObjectsAtIndexes(data, index1, index2); } -void CCArray::replaceObjectAtIndex(unsigned int index, CCObject* pObject, bool bReleaseObject/* = true*/) -{ - ccArrayInsertObjectAtIndex(data, pObject, index); - ccArrayRemoveObjectAtIndex(data, index+1); +void CCArray::replaceObjectAtIndex(unsigned int index, CCObject* pObject, bool bReleaseObject/* = true*/) +{ + ccArrayInsertObjectAtIndex(data, pObject, index); + ccArrayRemoveObjectAtIndex(data, index+1); } void CCArray::reverseObjects() diff --git a/cocos2dx/cocoa/CCArray.h b/cocos2dx/cocoa/CCArray.h index 500cd82585..71dd1129ae 100644 --- a/cocos2dx/cocoa/CCArray.h +++ b/cocos2dx/cocoa/CCArray.h @@ -160,7 +160,7 @@ public: CCObject* randomObject(); /** Returns a Boolean value that indicates whether object is present in array. */ bool containsObject(CCObject* object); - /** @since 1.1 */ + /** @since 1.1 */ bool isEqualToArray(CCArray* pOtherArray); // Adding Objects diff --git a/cocos2dx/misc_nodes/CCMotionStreak.cpp b/cocos2dx/misc_nodes/CCMotionStreak.cpp index 94c5b9ae27..32dd1f7025 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.cpp +++ b/cocos2dx/misc_nodes/CCMotionStreak.cpp @@ -319,15 +319,15 @@ void CCMotionStreak::update(float delta) ccVertexLineToPolygon(m_pPointVertexes, m_fStroke, m_pVertices, 0, m_uNuPoints); } - // Updated Tex Coords only if they are different than previous step - if( m_uNuPoints && m_uPreviousNuPoints != m_uNuPoints ) { - float texDelta = 1.0f / m_uNuPoints; - for( i=0; i < m_uNuPoints; i++ ) { - m_pTexCoords[i*2] = tex2(0, texDelta*i); - m_pTexCoords[i*2+1] = tex2(1, texDelta*i); - } - - m_uPreviousNuPoints = m_uNuPoints; + // Updated Tex Coords only if they are different than previous step + if( m_uNuPoints && m_uPreviousNuPoints != m_uNuPoints ) { + float texDelta = 1.0f / m_uNuPoints; + for( i=0; i < m_uNuPoints; i++ ) { + m_pTexCoords[i*2] = tex2(0, texDelta*i); + m_pTexCoords[i*2+1] = tex2(1, texDelta*i); + } + + m_uPreviousNuPoints = m_uNuPoints; } } diff --git a/cocos2dx/misc_nodes/CCRenderTexture.h b/cocos2dx/misc_nodes/CCRenderTexture.h index b04b0832b1..a68d3443f3 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.h +++ b/cocos2dx/misc_nodes/CCRenderTexture.h @@ -59,7 +59,7 @@ public: CCRenderTexture(); virtual ~CCRenderTexture(); - /** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/ + /** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/ static CCRenderTexture * renderTextureWithWidthAndHeight(int w ,int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat); /** creates a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */ @@ -71,7 +71,7 @@ public: /** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */ bool initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat); - /** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/ + /** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/ bool initWithWidthAndHeight(int w, int h, CCTexture2DPixelFormat eFormat, GLuint uDepthStencilFormat); /** starts grabbing */ @@ -81,12 +81,12 @@ public: This is more efficient then calling -clear first and then -begin */ void beginWithClear(float r, float g, float b, float a); - /** starts rendering to the texture while clearing the texture first. - This is more efficient then calling -clear first and then -begin */ - void beginWithClear(float r, float g, float b, float a, float depthValue); - - /** starts rendering to the texture while clearing the texture first. - This is more efficient then calling -clear first and then -begin */ + /** starts rendering to the texture while clearing the texture first. + This is more efficient then calling -clear first and then -begin */ + void beginWithClear(float r, float g, float b, float a, float depthValue); + + /** starts rendering to the texture while clearing the texture first. + This is more efficient then calling -clear first and then -begin */ void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue); /** end is key word of lua, use other name to export to lua. */ @@ -99,10 +99,10 @@ public: /** clears the texture with a color */ void clear(float r, float g, float b, float a); - /** clears the texture with a specified depth value */ - void clearDepth(float depthValue); - - /** clears the texture with a specified stencil value */ + /** clears the texture with a specified depth value */ + void clearDepth(float depthValue); + + /** clears the texture with a specified stencil value */ void clearStencil(int stencilValue); /* creates a new CCImage from with the texture's data. Caller is responsible for releasing it by calling delete. @@ -130,4 +130,4 @@ protected: NS_CC_END -#endif //__CCRENDER_TEXTURE_H__ \ No newline at end of file +#endif //__CCRENDER_TEXTURE_H__ diff --git a/cocos2dx/particle_nodes/CCParticleSystem.h b/cocos2dx/particle_nodes/CCParticleSystem.h index 60073ffafa..26b4ea1efe 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.h +++ b/cocos2dx/particle_nodes/CCParticleSystem.h @@ -324,8 +324,8 @@ public: CC_PROPERTY(CCTexture2D*, m_pTexture, Texture) /** conforms to CocosNodeTexture protocol */ CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc) - /** does the alpha value modify color */ - CC_PROPERTY(bool, m_bOpacityModifyRGB, OpacityModifyRGB) + /** does the alpha value modify color */ + CC_PROPERTY(bool, m_bOpacityModifyRGB, OpacityModifyRGB) /** whether or not the particles are using blend additive. If enabled, the following blending function will be used. diff --git a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp index 62c31058b4..144a93f4dc 100644 --- a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp @@ -236,8 +236,8 @@ void CCParticleSystemQuad::updateQuadWithParticle(tCCParticle* particle, const C { quad = &(m_pQuads[m_uParticleIdx]); } - ccColor4B color = (m_bOpacityModifyRGB) - ? ccc4( particle->color.r*particle->color.a*255, particle->color.g*particle->color.a*255, particle->color.b*particle->color.a*255, particle->color.a*255) + ccColor4B color = (m_bOpacityModifyRGB) + ? ccc4( particle->color.r*particle->color.a*255, particle->color.g*particle->color.a*255, particle->color.b*particle->color.a*255, particle->color.a*255) : ccc4( particle->color.r*255, particle->color.g*255, particle->color.b*255, particle->color.a*255); quad->bl.colors = color; diff --git a/cocos2dx/textures/CCTexture2D.h b/cocos2dx/textures/CCTexture2D.h index 1e5aea7c62..523a6cfa4a 100644 --- a/cocos2dx/textures/CCTexture2D.h +++ b/cocos2dx/textures/CCTexture2D.h @@ -195,15 +195,15 @@ public: */ unsigned int bitsPerPixelForFormat(); - /** returns the pixel format in a NSString. - @since v2.0 - */ - CCString* stringForFormat(); - - - /** Helper functions that returns bits per pixels for a given format. - @since v2.0 - */ + /** returns the pixel format in a NSString. + @since v2.0 + */ + CCString* stringForFormat(); + + + /** Helper functions that returns bits per pixels for a given format. + @since v2.0 + */ unsigned int bitsPerPixelForFormat(CCTexture2DPixelFormat format); /** sets the default pixel format for UIImagescontains alpha channel. @@ -217,8 +217,8 @@ public: How does it work ? - If the image is an RGBA (with Alpha) then the default pixel format will be used (it can be a 8-bit, 16-bit or 32-bit texture) - - If the image is an RGB (without Alpha) then: If the default pixel format is RGBA8888 then a RGBA8888 (32-bit) will be used. Otherwise a RGB565 (16-bit texture) will be used. - + - If the image is an RGB (without Alpha) then: If the default pixel format is RGBA8888 then a RGBA8888 (32-bit) will be used. Otherwise a RGB565 (16-bit texture) will be used. + This parameter is not valid for PVR / PVR.CCZ images. @since v0.8 diff --git a/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp b/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp index 3482411195..fc32d7455f 100644 --- a/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp +++ b/cocos2dx/tileMap_parallax_nodes/CCTMXLayer.cpp @@ -236,52 +236,52 @@ void CCTMXLayer::setupTileSprite(CCSprite* sprite, CCPoint pos, unsigned int gid sprite->setOpacity(m_cOpacity); //issue 1264, flip can be undone as well - sprite->setFlipX(false); - sprite->setFlipX(false); - sprite->setRotation(0.0f); - sprite->setAnchorPoint(ccp(0,0)); - - // Rotation in tiled is achieved using 3 flipped states, flipping across the horizontal, vertical, and diagonal axes of the tiles. - if (gid & kCCTMXTileDiagonalFlag) - { - // put the anchor in the middle for ease of rotation. - sprite->setAnchorPoint(ccp(0.5f,0.5f)); - sprite->setPosition(ccp(positionAt(pos).x + sprite->getContentSize().height/2, - positionAt(pos).y + sprite->getContentSize().width/2 ) ); - - unsigned int flag = gid & (kCCTMXTileHorizontalFlag | kCCTMXTileVerticalFlag ); - - // handle the 4 diagonally flipped states. - if (flag == kCCTMXTileHorizontalFlag) - { - sprite->setRotation(90.0f); - } - else if (flag == kCCTMXTileVerticalFlag) - { - sprite->setRotation(270.0f); - } - else if (flag == (kCCTMXTileVerticalFlag | kCCTMXTileHorizontalFlag) ) - { - sprite->setRotation(90.0f); - sprite->setFlipX(true); - } - else - { - sprite->setRotation(270.0f); - sprite->setFlipX(true); - } - } - else - { - if (gid & kCCTMXTileHorizontalFlag) - { - sprite->setFlipX(true); - } - - if (gid & kCCTMXTileVerticalFlag) - { - sprite->setFlipY(true); - } + sprite->setFlipX(false); + sprite->setFlipX(false); + sprite->setRotation(0.0f); + sprite->setAnchorPoint(ccp(0,0)); + + // Rotation in tiled is achieved using 3 flipped states, flipping across the horizontal, vertical, and diagonal axes of the tiles. + if (gid & kCCTMXTileDiagonalFlag) + { + // put the anchor in the middle for ease of rotation. + sprite->setAnchorPoint(ccp(0.5f,0.5f)); + sprite->setPosition(ccp(positionAt(pos).x + sprite->getContentSize().height/2, + positionAt(pos).y + sprite->getContentSize().width/2 ) ); + + unsigned int flag = gid & (kCCTMXTileHorizontalFlag | kCCTMXTileVerticalFlag ); + + // handle the 4 diagonally flipped states. + if (flag == kCCTMXTileHorizontalFlag) + { + sprite->setRotation(90.0f); + } + else if (flag == kCCTMXTileVerticalFlag) + { + sprite->setRotation(270.0f); + } + else if (flag == (kCCTMXTileVerticalFlag | kCCTMXTileHorizontalFlag) ) + { + sprite->setRotation(90.0f); + sprite->setFlipX(true); + } + else + { + sprite->setRotation(270.0f); + sprite->setFlipX(true); + } + } + else + { + if (gid & kCCTMXTileHorizontalFlag) + { + sprite->setFlipX(true); + } + + if (gid & kCCTMXTileVerticalFlag) + { + sprite->setFlipY(true); + } } }