Permalink
Browse files

Issue 1262, tiles retrieved as sprite do not need to activate the sor…

…ting of children.
  • Loading branch information...
araker committed Oct 16, 2011
1 parent 67c0853 commit 242a68a5998f5f438f64f9f07c76c9c0a64dc37c
Showing with 7 additions and 4 deletions.
  1. +1 −1 cocos2d/CCSprite.m
  2. +1 −1 cocos2d/CCSpriteBatchNode.h
  3. +2 −2 cocos2d/CCSpriteBatchNode.m
  4. +3 −0 cocos2d/CCTMXLayer.m
View
@@ -669,7 +669,7 @@ -(void) reorderChild:(CCSprite*)child z:(NSInteger)z
if (!isReorderChildDirty_)
{
[self setReorderChildDirtyRecursively];
- [batchNode_ reorderBatch];
+ [batchNode_ reorderBatch:YES];
}
}
@@ -125,6 +125,6 @@
-(NSUInteger) rebuildIndexInOrder:(CCSprite*)parent atlasIndex:(NSUInteger)index;
-(NSUInteger) atlasIndexForChild:(CCSprite*)sprite atZ:(NSInteger)z;
/* Sprites use this to start sortChildren, don't call this manually */
-- (void) reorderBatch;
+- (void) reorderBatch:(BOOL) reorder;
@end
@@ -350,9 +350,9 @@ - (void) swap:(int) oldIndex withNewIndex:(int) newIndex
quads[newIndex]=tempItemQuad;
}
-- (void) reorderBatch
+- (void) reorderBatch:(BOOL) reorder
{
- isReorderChildDirty_=YES;
+ isReorderChildDirty_=reorder;
}
#pragma mark CCSpriteBatchNode - draw
View
@@ -102,6 +102,9 @@ -(id) addSpriteWithoutQuad:(CCSprite*)child z:(NSUInteger)z tag:(NSInteger)aTag
// IMPORTANT: Call super, and not self. Avoid adding it to the texture atlas array
[super addChild:child z:z tag:aTag];
+
+ //#issue 1262 don't use lazy sorting, tiles are added as quads not as sprites, so sprites need to be added in order
+ [self reorderBatch:NO];
return self;
}
@end

0 comments on commit 242a68a

Please sign in to comment.