1
votes

How to display the bounding box without using any frameworks. Just normal cocos2d?

1
look into ccConfig.h, there are bbox debug macros you dan enable - LearnCocos2D

1 Answers

0
votes

Very cool feature in Cocos2d, search ccConfig.h, there you will find this part:

/** @def CC_SPRITE_DEBUG_DRAW
If enabled, all subclasses of CCSprite will draw a bounding box.
Useful for debugging purposes only. It is recommended to leave it disabled.

If the CCSprite is being drawn by a CCSpriteBatchNode, the bounding box might be a bit different.
To enable set it to a value different than 0. Disabled by default:
0 -- disabled
1 -- draw bounding box
2 -- draw texture box
*/
#ifndef CC_SPRITE_DEBUG_DRAW
#define CC_SPRITE_DEBUG_DRAW 0
#endif

Change the line #define CC_SPRITE_DEBUG_DRAW, the 0 to 1. And every CCSprite, so also CCLabelTTF now has a white hairline boundary box.