Projects > cpp > Issues > Bug #3864

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

When trying to set bounding box in ccConfig.h getting compilation error

Bug #3864 [Closed]
Meir_yanovich 2014-01-26 19:40 . Updated about 10 years ago

I try to set the configuration incocos2d-x-3.0beta\cocos2d-x-3.0beta\cocos\2d\ccConfig.h
like this :
`#ifndef CC_SPRITE_DEBUG_DRAW

define CC_SPRITE_DEBUG_DRAW 1

endif

ifndef CC_SPRITEBATCHNODE_DEBUG_DRAW

define CC_SPRITEBATCHNODE_DEBUG_DRAW 1

endif`

im getting compilation error :

1>CCSprite.cpp(602): error C3861: 'ccDrawPoly': identifier not found

tested on windows 7 64bit with visual studio2012 express

Meir_yanovich 2014-01-27 11:27

The CC_SPRITEBATCHNODE_DEBUG_DRAW define not even appear any where in the code , only in the ccConfig.h file.

Meir_yanovich 2014-01-30 08:21

few more things ,
the fix to the ccDrawPoly is to replace it with DrawPrimitives::drawPoly(vertices, 4, true);
BUT , as i see in the CCSprite class , the bounding box is drawen only when using as being rendered using an SpriteBatchNode.
and never other case , this is problem when your sprite is not part of SpriteBatchNode.
for example using Sprite as Animation container for SpriteFrame's
for now i just overwrite the draw method of the Sprite to draw bounding box like this :

void MySprite::draw()
{
     Sprite::draw();


    _customCommand.init(_globalZOrder);
    _customCommand.func = CC_CALLBACK_0(Block::onDraw, this);
    Director::getInstance()->getRenderer()->addCommand(&_customCommand); 


}
void MySprite::onDraw()
{

    kmMat4 oldMat;
    kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
    kmGLLoadMatrix(&_modelViewTransform);

    //draw
    CHECK_GL_ERROR_DEBUG();
    // draw bounding box
    Point vertices[4] = {
        Point( _quad.bl.vertices.x, _quad.bl.vertices.y ),
        Point( _quad.br.vertices.x, _quad.br.vertices.y ),
        Point( _quad.tr.vertices.x, _quad.tr.vertices.y ),
        Point( _quad.tl.vertices.x, _quad.tl.vertices.y ),
    };
    //ccDrawPoly(vertices, 4, true);
    DrawPrimitives::drawPoly(vertices, 4, true);
     //end draw
    kmGLLoadMatrix(&oldMat);

}

walzer@cocos2d-x.org 2014-10-08 02:48

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8327

Atom PDF

Status:Closed
Start date:2014-01-26
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:native client, windows
Target version:-