You must use ccDrawLine
function in draw()
Example
void GameLayer::draw()
{
//red line from bottom left to top right corner
cocos2d::ccDrawColor4F(1.0f, 0.0f, 0.0f, 1.0f);
cocos2d::ccDrawLine(ccp(0,0), ccp(100, 100));
}
And remember layer must be empty because it call first draw next it will draw children so if you have children it will overlap what you draw.
Z order :)
So in your code you have class
class MyLayer : public CCLayer
{
... //your code
init()
{
CCLayer* pLayer = new GameLayer(); //It will be debug layer :)
addChild(pLayer);//Alse you can set here Z order.
pLayer->release();
}
virtual void draw()
{
//red line from bottom left to top right corner
ccDrawColor4F(1.0f, 0.0f, 0.0f, 1.0f);
ccDrawLine(ccp(0,0), ccp(100, 100));
}
}
Above code will draw what you want.