void TowerP::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated){
if (m_isDebug){
_customCommand.init(_globalZOrder);
_customCommand.func = CC_CALLBACK_0(TowerP::onDraw, this, transform, transformUpdated);
renderer->addCommand(&_customCommand);
}
}
void TowerP::onDraw(const kmMat4 &transform, bool transformUpdated){
kmGLPushMatrix();
kmGLLoadMatrix(&transform);
glLineWidth(5.0f);
Point srcPos = Point(m_pos.x - R, m_pos.y + R);
Point destPos = Point(m_pos.x+R, m_pos.y - R);
DrawPrimitives::drawRect(srcPos, destPos);
glLineWidth(1);
kmGLPopMatrix();
}
初始化TowerP,_customCommand.func一直显示为空。
求大神解答!