Cocos2DXNA / cocos2d-xna

XNA Port of Cocos2d-X
www.cocos2dxna.com
227 stars 123 forks source link

Allow SpriteBatch and MenuItemSprite to share children #391

Open totallyeviljake opened 10 years ago

totallyeviljake commented 10 years ago

If a sprite has a parent as a sprite batch node and that sprite is used in a CCMenuItemSprite then it should not be drawn by the menu parent. Rather, it should be drawn in the sprite batch.

totallyeviljake commented 10 years ago

The problem with SpriteBatch is that it draws sprites relative to its own z-order. This is where the global-Z-order concept from cocos2d-x v3 is useful. Without applying the sprite batch to a global z ordering, the sprites that would be in the menu would be occluded by other sprites that occur after the sprite batch node in the node hierarchy.