Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MyLayer::draw()
- {
- // super draw
- CCLayer::draw();
- // Iterate through all nodes of this layer
- for ( CCNode* node = ??? )
- {
- // Make sure the node is a CCSprite
- if ( node == CCSprite ??? )
- {
- CCSprite* sprite = (CCSprite*) node;
- ccDrawRect( sprite->boundingBox() ??? );
- }
- }
- }
- //put this line at the top of your cpp file
- #define CC_VERIFY_TYPE(__OBJECT__,__CLASS_TYPE__) assert(dynamic_cast<__CLASS_TYPE__>(__OBJECT__))
- //these lines in your code
- CCObject* child;
- CCARRAY_FOREACH(m_pChildren, child)
- {
- CC_VERIFY_TYPE(child,CCSprite*);
- CCSprite* sprite = (CCSprite*) child;
- CCSize s = sprite->boundingBox().size;
- ccDrawRect(sprite->boundingBox().origin, ccpAdd(sprite->boundingBox().origin, (ccp(s.width,s.height))));
- }
Add Comment
Please, Sign In to add comment