开发者

How to use debugdraw with MacOS / cocos2d / Box2d

How i can debugdraw with a cocos2d/macos code ? i cant use GLESDebu开发者_开发问答gDraw, any clue?


Im not sure what you need, but cocos2d got some draw methods. You can maybe use this code

-(void)draw
{
for (NSValue* rect in spots) {
    CGRect r = [rect CGRectValue];
    CGPoint vertices2[] = {
        ccp(r.origin.x,r.origin.y),
        ccp(r.origin.x, r.size.height + r.origin.y),
        ccp(r.size.width + r.origin.x, r.size.height + r.origin.y),
        ccp(r.size.width + r.origin.x, r.origin.y)
    }; 
    ccDrawPoly(vertices2, 4, YES);
}

For other debug output, check ccConfig.h (just type it in the search field left bottom of the projekt view). On line 229 is #define CC_SPRITE_DEBUG_DRAW 0. Set it to 1 and you can see the boundingbox of all sprites.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜