cocos2dx lua draw

前端之家收集整理的这篇文章主要介绍了cocos2dx lua draw前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
 
lua的写法
    local myDrawNode=cc.DrawNode:create()
    self:addChild(myDrawNode,10)
    myDrawNode:setPosition(cc.p(480,320))
    myDrawNode:drawSolidRect(cc.p(100,100),cc.p(20,20),cc.c4f(1,1,1))

c++的写法

    DrawNode*myDraw=DrawNode::create();
    this->addChild(myDraw,10);
    myDraw->drawLine(Vec2(0,0),Vec2(480,320),Color4F(1,1));
    myDraw->drawRect(Vec2(23,23),Vec2(500,500),1));
    myDraw->setPosition(Vec2(90,90));
    //myDraw->setScale(0.2);

    myDraw->drawSolidCircle(Vec2(100,50,CC_DEGREES_TO_RADIANS(90),1));
    //myDraw->drawSolidCircle( VisibleRect::center() + Vec2(140,40,2.0f,Color4F(0.0,1.0,0.0,1.0));
原文链接:https://www.f2er.com/cocos2dx/343137.html

猜你在找的Cocos2d-x相关文章