axmol/cocos/2d/renderer/CCNewDrawNode.cpp

59 lines
879 B
C++
Raw Normal View History

2013-11-16 03:29:11 +08:00
//
// Created by NiTe Luo on 11/14/13.
//
#include "CCNewDrawNode.h"
2013-11-19 06:58:41 +08:00
#include "QuadCommand.h"
2013-11-20 03:06:26 +08:00
#include "Renderer.h"
2013-11-20 05:57:39 +08:00
#include "CustomCommand.h"
2013-11-16 03:29:11 +08:00
NS_CC_BEGIN
NewDrawNode *NewDrawNode::create()
{
NewDrawNode* pRet = new NewDrawNode();
if (pRet && pRet->init())
{
pRet->autorelease();
}
else
{
CC_SAFE_DELETE(pRet);
}
return pRet;
}
NewDrawNode::NewDrawNode()
{
}
NewDrawNode::~NewDrawNode()
{
}
bool NewDrawNode::init()
{
2013-11-16 09:32:29 +08:00
return DrawNode::init();
2013-11-16 03:29:11 +08:00
}
2013-11-20 05:57:39 +08:00
void NewDrawNode::draw()
2013-11-20 03:06:26 +08:00
{
CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand();
cmd->init(0, _vertexZ);
2013-11-20 05:57:39 +08:00
cmd->func = CC_CALLBACK_0(NewDrawNode::onDraw, this);
Renderer::getInstance()->addCommand(cmd);
2013-11-20 03:06:26 +08:00
}
2013-11-20 05:57:39 +08:00
void NewDrawNode::onDraw()
2013-11-16 03:29:11 +08:00
{
2013-11-20 05:57:39 +08:00
CC_NODE_DRAW_SETUP();
GL::blendFunc(_blendFunc.src, _blendFunc.dst);
render();
2013-11-16 03:29:11 +08:00
}
NS_CC_END