<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>tests/EaseActionsTest.h</filename>
    </added>
    <added>
      <filename>tests/EaseActionsTest.m</filename>
    </added>
    <added>
      <filename>tests/TransitionsTest.h</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -271,7 +271,7 @@
 		505B639D0F2F4210001B4104 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D500B920D5A79C200DBA0E3 /* OpenGLES.framework */; };
 		505B639E0F2F4210001B4104 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D500B990D5A79CF00DBA0E3 /* QuartzCore.framework */; };
 		505B639F0F2F4210001B4104 /* libcocos2d.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5018F24D0DFDEAC400C013A5 /* libcocos2d.a */; };
-		505B63A80F2F4295001B4104 /* EaseTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 505B63A70F2F4295001B4104 /* EaseTest.m */; };
+		505B63A80F2F4295001B4104 /* EaseActionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 505B63A70F2F4295001B4104 /* EaseActionsTest.m */; };
 		505CC1840F62BB7A000EDF26 /* CocosNodePerformance.m in Sources */ = {isa = PBXBuildFile; fileRef = 505CC17D0F62BB7A000EDF26 /* CocosNodePerformance.m */; };
 		505CC1850F62BB7A000EDF26 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 505CC17F0F62BB7A000EDF26 /* AppController.m */; };
 		505CC1860F62BB7A000EDF26 /* MainScene.m in Sources */ = {isa = PBXBuildFile; fileRef = 505CC1810F62BB7A000EDF26 /* MainScene.m */; };
@@ -1163,8 +1163,8 @@
 		505B62DE0F2E6A66001B4104 /* Texture2dTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Texture2dTest.h; path = tests/Texture2dTest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
 		505B62DF0F2E6A66001B4104 /* Texture2dTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Texture2dTest.m; path = tests/Texture2dTest.m; sourceTree = &quot;&lt;group&gt;&quot;; };
 		505B63A30F2F4210001B4104 /* EaseDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EaseDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
-		505B63A60F2F4295001B4104 /* EaseTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EaseTest.h; path = tests/EaseTest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-		505B63A70F2F4295001B4104 /* EaseTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EaseTest.m; path = tests/EaseTest.m; sourceTree = &quot;&lt;group&gt;&quot;; };
+		505B63A60F2F4295001B4104 /* EaseActionsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EaseActionsTest.h; path = tests/EaseActionsTest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+		505B63A70F2F4295001B4104 /* EaseActionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EaseActionsTest.m; path = tests/EaseActionsTest.m; sourceTree = &quot;&lt;group&gt;&quot;; };
 		505CC1590F62BB03000EDF26 /* PerformanceTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PerformanceTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		505CC17C0F62BB7A000EDF26 /* CocosNodePerformance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosNodePerformance.h; sourceTree = &quot;&lt;group&gt;&quot;; };
 		505CC17D0F62BB7A000EDF26 /* CocosNodePerformance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocosNodePerformance.m; sourceTree = &quot;&lt;group&gt;&quot;; };
@@ -1314,7 +1314,7 @@
 		50C723DB0EC062680046C5DB /* clouds.pvrtc */ = {isa = PBXFileReference; lastKnownFileType = text; path = clouds.pvrtc; sourceTree = &quot;&lt;group&gt;&quot;; };
 		50C7D4950E5C2ED80035ACA2 /* IntervalDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IntervalDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		50C938E00E0A9DBB00517B01 /* TransitionsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TransitionsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
-		50C938E30E0A9E1100517B01 /* TransitionsTesth */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = TransitionsTesth; path = tests/TransitionsTesth; sourceTree = &quot;&lt;group&gt;&quot;; };
+		50C938E30E0A9E1100517B01 /* TransitionsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransitionsTest.h; path = tests/TransitionsTest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
 		50C938E40E0A9E1100517B01 /* TransitionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TransitionsTest.m; path = tests/TransitionsTest.m; sourceTree = &quot;&lt;group&gt;&quot;; };
 		50C93AAD0E0BF6E000517B01 /* SpritesDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SpritesDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		50C93AC30E0BF8FC00517B01 /* SpritesTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpritesTest.h; path = tests/SpritesTest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
@@ -2296,8 +2296,8 @@
 				50B2C5EC0E100F8800AE9530 /* ChipmunkAccelTouchTest.m */,
 				5061440B0E589A7B003CCDB7 /* cocosnodeTest.h */,
 				5061440C0E589A7B003CCDB7 /* cocosnodeTest.m */,
-				505B63A60F2F4295001B4104 /* EaseTest.h */,
-				505B63A70F2F4295001B4104 /* EaseTest.m */,
+				505B63A60F2F4295001B4104 /* EaseActionsTest.h */,
+				505B63A70F2F4295001B4104 /* EaseActionsTest.m */,
 				50D5700D0F3FAD3C007CD6B9 /* EffectsAdvancedTest.h */,
 				50D5700E0F3FAD3C007CD6B9 /* EffectsAdvancedTest.m */,
 				50A24E6F0F377FE8007CAEB0 /* EffectsTest.h */,
@@ -2318,7 +2318,7 @@
 				50C93AC40E0BF8FC00517B01 /* SpritesTest.m */,
 				505B62DE0F2E6A66001B4104 /* Texture2dTest.h */,
 				505B62DF0F2E6A66001B4104 /* Texture2dTest.m */,
-				50C938E30E0A9E1100517B01 /* TransitionsTesth */,
+				50C938E30E0A9E1100517B01 /* TransitionsTest.h */,
 				50C938E40E0A9E1100517B01 /* TransitionsTest.m */,
 				50B2CB170E10EE0800AE9530 /* main.m */,
 				50B2CB180E10EE0800AE9530 /* Prefix.pch */,
@@ -4003,7 +4003,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				505B63980F2F4210001B4104 /* main.m in Sources */,
-				505B63A80F2F4295001B4104 /* EaseTest.m in Sources */,
+				505B63A80F2F4295001B4104 /* EaseActionsTest.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};</diff>
      <filename>cocos2d-iphone.xcodeproj/project.pbxproj</filename>
    </modified>
    <modified>
      <diff>@@ -28,10 +28,10 @@ const int defaultCapacity = 29;
 -(void)setIndex:(int)index
 {
 	mAtlasIndex = index;
-	[self updateAtlas];
-
-	if( mAtlas.withColorArray )
-		[self updateColor];
+//	[self updateAtlas];
+//
+//	if( mAtlas.withColorArray )
+//		[self updateColor];
 }
 @end
 
@@ -126,7 +126,7 @@ const int defaultCapacity = 29;
 	// if we're going beyond the current TextureAtlas's capacity,
 	// all the previously initialized sprites will need to redo their texture coords
 	// this is likely computationally expensive
-	if(mTotalSprites == mAtlas.totalQuads)
+	if(mTotalSprites == mAtlas.capacity)
 	{
 		CCLOG(@&quot;Resizing TextureAtlas capacity, from [%d] to [%d].&quot;, mAtlas.totalQuads, mAtlas.totalQuads * 3 / 2);
 
@@ -156,6 +156,8 @@ const int defaultCapacity = 29;
 	
 	[child setIndex: [self indexForNewChild] ];
 	[child updateAtlas];
+	if( mAtlas.withColorArray )
+		[child updateColor];
 
 	mTotalSprites++;
 	return [super addChild:child z:z tag:aTag];
@@ -172,6 +174,9 @@ const int defaultCapacity = 29;
 
 	// update all sprites beyond this one
 	int count = [children count];
+	
+	[mAtlas removeQuadAtIndex:index];
+
 	for(; index &lt; count; index++)
 	{
 		AtlasSprite *other = (AtlasSprite *)[children objectAtIndex:index];
@@ -189,6 +194,8 @@ const int defaultCapacity = 29;
 -(void)removeAllChildrenWithCleanup:(BOOL)doCleanup
 {
 	[super removeAllChildrenWithCleanup:doCleanup];
+	
+	// BUG XXX: atlas should be purged as well
 	mTotalSprites = 0;
 }
 
@@ -213,7 +220,7 @@ const int defaultCapacity = 29;
 
 		glEnable(GL_TEXTURE_2D);
 
-		[mAtlas drawNumberOfQuads:mTotalSprites];
+		[mAtlas drawQuads];
 
 		glDisable(GL_TEXTURE_2D);
 </diff>
      <filename>cocos2d/AtlasSpriteManager.m</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,8 @@
  * The Texture Atlas supports vertex array and color array.
  */
 @interface TextureAtlas : NSObject {
-	NSUInteger			totalQuads;
+	NSUInteger			_totalQuads;
+	NSUInteger			_capacity;
 	ccQuad2		*texCoordinates;
 	ccQuad3		*vertices;
 	ccColorB	*colors;			// RGBA for each vertex
@@ -29,8 +30,13 @@
 	BOOL		_withColorArray;
 }
 
+/** quantity of quads that are going to be drawn */
 @property (readonly) NSUInteger totalQuads;
+/** quantity of quads that can be stored with the current texture atlas size */
+@property (readonly) NSUInteger capacity;
+/** Texture of the texture atlas */
 @property (nonatomic,retain) Texture2D *texture;
+/** whether or not the TextureAtlas object is using a color array */
 @property (readonly) BOOL withColorArray;
 
 /** creates a TextureAtlas with an iname filename and with a capacity for n Quads
@@ -78,6 +84,11 @@
  */
 -(void) drawQuads;
 
+/** removes a quad at a given index number.
+ The capacity remains the same, but the total number of quads to be drawn is reduced in 1
+ @since v0.7.2
+ */
+-(void) removeQuadAtIndex:(NSUInteger) index;
 
 /** resize the capacity of the Texture Atlas.
  * The new capacity can be lower or higher</diff>
      <filename>cocos2d/TextureAtlas.h</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,8 @@
 
 @implementation TextureAtlas
 
-@synthesize totalQuads, texture;
+@synthesize totalQuads = _totalQuads, capacity = _capacity;
+@synthesize texture;
 @synthesize withColorArray = _withColorArray;
 
 #pragma mark TextureAtlas - alloc &amp; init
@@ -56,16 +57,16 @@
 	if( ! (self=[super init]) )
 		return nil;
 	
-	totalQuads = n;
+	_capacity = n;
 	
 	// retained in property
 	self.texture = tex;
 
 	_withColorArray = NO;
 
-	texCoordinates = malloc( sizeof(texCoordinates[0]) * totalQuads );
-	vertices = malloc( sizeof(vertices[0]) * totalQuads );
-	indices = malloc( sizeof(indices[0]) * totalQuads * 6 );
+	texCoordinates = malloc( sizeof(texCoordinates[0]) * _capacity );
+	vertices = malloc( sizeof(vertices[0]) * _capacity );
+	indices = malloc( sizeof(indices[0]) * _capacity * 6 );
 	
 	if( ! ( texCoordinates &amp;&amp; vertices &amp;&amp; indices) ) {
 		NSLog(@&quot;TextureAtlas: not enough memory&quot;);
@@ -85,7 +86,7 @@
 
 - (NSString*) description
 {
-	return [NSString stringWithFormat:@&quot;&lt;%@ = %08X | totalQuads =  %i&gt;&quot;, [self class], self, totalQuads];
+	return [NSString stringWithFormat:@&quot;&lt;%@ = %08X | totalQuads =  %i&gt;&quot;, [self class], self, _totalQuads];
 }
 
 -(void) dealloc
@@ -106,15 +107,16 @@
 -(void) initColorArray
 {
 	if( ! _withColorArray ) {
-		colors = malloc( sizeof(colors[0]) * totalQuads * 4 );
-		memset(colors, 0xFF,  totalQuads * 4 * sizeof(colors[0]));
+		colors = malloc( sizeof(colors[0]) * _capacity * 4 );
+		// default color: 255,255,255,255
+		memset(colors, 0xFF,  _capacity * 4 * sizeof(colors[0]));
 		_withColorArray = YES;
 	}
 }
 
 -(void) initIndices
 {
-	for( NSUInteger i=0;i&lt;totalQuads;i++) {
+	for( NSUInteger i=0;i&lt; _capacity;i++) {
 		indices[i*6+0] = i*4+0;
 		indices[i*6+1] = i*4+1;
 		indices[i*6+2] = i*4+2;
@@ -127,12 +129,14 @@
 	}
 }
 
-#pragma mark TextureAtlas - Updates
+#pragma mark TextureAtlas - Updates &amp; Remove
 
 -(void) updateQuadWithTexture: (ccQuad2*) quadT vertexQuad:(ccQuad3*) quadV atIndex:(NSUInteger) n
 {
 	
-	NSAssert( n &gt;= 0 &amp;&amp; n &lt; totalQuads, @&quot;updateQuadWithTexture: Invalid index&quot;);
+	NSAssert( n &gt;= 0 &amp;&amp; n &lt; _capacity, @&quot;updateQuadWithTexture: Invalid index&quot;);
+
+	_totalQuads =  MAX( n+1, _totalQuads);
 
 	texCoordinates[n] = *quadT;
 	vertices[n] = *quadV;
@@ -140,29 +144,51 @@
 
 -(void) updateColorWithColorQuad:(ccColorB*)color atIndex:(NSUInteger)n
 {
-	NSAssert( n &gt;= 0 &amp;&amp; n &lt; totalQuads, @&quot;updateColorWithQuadColor: Invalid index&quot;);
+	NSAssert( n &gt;= 0 &amp;&amp; n &lt; _capacity, @&quot;updateColorWithQuadColor: Invalid index&quot;);
 
+	_totalQuads =  MAX( n+1, _totalQuads);
+	
 	if( ! _withColorArray )
 		[self initColorArray];
 	for( int i=0;i&lt;4;i++)
 		colors[n*4+i] = *color;
 }
 
+-(void) removeQuadAtIndex:(NSUInteger) index
+{
+	NSAssert( index &gt;= 0 &amp;&amp; index &lt; _totalQuads, @&quot;removeQuadAtIndex: Invalid index&quot;);
+	
+	NSUInteger remaining = (_totalQuads-1) - index;
+	
+	// last object doesn't need to be moved
+	if( remaining ) {
+		// tex coordinates
+		memmove( &amp;texCoordinates[index],&amp;texCoordinates[index+1], sizeof(texCoordinates[0]) * remaining );
+		// vertices
+		memmove( &amp;vertices[index], &amp;vertices[index+1], sizeof(vertices[0]) * remaining );
+		// colors
+		if(_withColorArray)
+			memmove(&amp;colors[index*4], &amp;colors[(index+1)*4], sizeof(colors[0]) * remaining * 4);
+	}
+	
+	_totalQuads--;
+}
+
 #pragma mark TextureAtlas - Resize
 
 -(void) resizeCapacity: (NSUInteger) n
 {
-	if( n == totalQuads )
+	if( n == _capacity )
 		return;
 	
-	totalQuads = n;
+	_capacity = n;
 
-	texCoordinates = realloc( texCoordinates, sizeof(texCoordinates[0]) * totalQuads );
-	vertices = realloc( vertices, sizeof(vertices[0]) * totalQuads );
-	indices = realloc( indices, sizeof(indices[0]) * totalQuads * 6 );
+	texCoordinates = realloc( texCoordinates, sizeof(texCoordinates[0]) * _capacity );
+	vertices = realloc( vertices, sizeof(vertices[0]) * _capacity );
+	indices = realloc( indices, sizeof(indices[0]) * _capacity * 6 );
 	
 	if( _withColorArray )
-		colors = realloc( colors, sizeof(colors[0]) * totalQuads * 4 );
+		colors = realloc( colors, sizeof(colors[0]) * _capacity * 4 );
 	
 	if( ! ( texCoordinates &amp;&amp; vertices &amp;&amp; indices) ) {
 		NSLog(@&quot;TextureAtlas: not enough memory&quot;);
@@ -184,7 +210,7 @@
 
 -(void) drawQuads
 {
-	return [self drawNumberOfQuads: totalQuads];
+	return [self drawNumberOfQuads: _totalQuads];
 }
 
 -(void) drawNumberOfQuads: (NSUInteger) n</diff>
      <filename>cocos2d/TextureAtlas.m</filename>
    </modified>
    <modified>
      <diff>@@ -154,6 +154,8 @@ Class restartAction()
 		[textureAtlas updateQuadWithTexture: &amp;texCoords[i] vertexQuad: &amp;vertices[i] atIndex:i];
 	}
 	
+	[textureAtlas removeQuadAtIndex:2];
+
 	return self;
 }
 
@@ -170,8 +172,10 @@ Class restartAction()
 	glEnableClientState( GL_TEXTURE_COORD_ARRAY );
 	
 	glEnable( GL_TEXTURE_2D);
-	
-	[textureAtlas drawNumberOfQuads:3];
+
+	[textureAtlas drawQuads];
+
+//	[textureAtlas drawNumberOfQuads:3];
 		
 	glDisable( GL_TEXTURE_2D);
 	</diff>
      <filename>tests/AtlasTest.m</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@
 
 // local import
 #import &quot;cocos2d.h&quot;
-#import &quot;TransitionsTesth&quot;
+#import &quot;TransitionsTest.h&quot;
 
 @interface FadeWhiteTransition : FadeTransition 
 +(id) transitionWithDuration:(ccTime) t scene:(Scene*)s;</diff>
      <filename>tests/TransitionsTest.m</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>tests/EaseTest.h</filename>
    </removed>
    <removed>
      <filename>tests/EaseTest.m</filename>
    </removed>
    <removed>
      <filename>tests/TransitionsTesth</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>4d5d68f738d9f0c28213594fa5755804bf699d4d</id>
    </parent>
  </parents>
  <author>
    <name>ricardoquesada</name>
    <email>ricardoquesada@79afc9a6-2f50-0410-804d-6f1bdedaafc9</email>
  </author>
  <url>http://github.com/nullstyle/cocos2d-iphone/commit/e24b7bb0fcdebfe8c9d46bb89d1c3f7d70c4d4c0</url>
  <id>e24b7bb0fcdebfe8c9d46bb89d1c3f7d70c4d4c0</id>
  <committed-date>2009-03-27T12:14:18-07:00</committed-date>
  <authored-date>2009-03-27T12:14:18-07:00</authored-date>
  <message>added TextureAtlas#removeQuad

part of issue #275

git-svn-id: http://cocos2d-iphone.googlecode.com/svn/trunk@734 79afc9a6-2f50-0410-804d-6f1bdedaafc9</message>
  <tree>07ff8b6f44ed18dd9c96c366457b94995acd1921</tree>
  <committer>
    <name>ricardoquesada</name>
    <email>ricardoquesada@79afc9a6-2f50-0410-804d-6f1bdedaafc9</email>
  </committer>
</commit>
