寒風的Cocos之旅之C++篇---drawNode用法

寒風的Cocos之旅之C++篇---drawNode用法,第1张

概述auto s = Director::getInstance()->getWinSize();          auto draw = DrawNode::create();     addChild(draw, 10);          // Draw 10 circles //    画同心圆     for( int i=0; i < 10; i++)     {         dra auto s = Director::getInstance()->getWinSize();

auto draw = DrawNode::create();

addChild(draw,10);

// Draw 10 circles
//画同心圆
for( int i=0; i < 10; i++)
{
draw->drawDot(Point(s.wIDth/2,s.height/2),10*(10-i),color4F(CCRANDOM_0_1(),CCRANDOM_0_1(),1));
}
// Draw polygons
画大三角形
Point points[] = { Point(s.height/4,0),Point(s.wIDth,s.height/5),Point(s.wIDth/3*2,s.height) };
draw->drawpolygon(points,sizeof(points)/sizeof(points[0]),color4F(1,0.5),4,color4F(0,1,Simsun; Font-size:16px; line-height:24px">// star poly (triggers BUGgs)
画多边形
const float o=80;
const float w=20;
const float h=50;
Point star[] = {
Point(o+w,o-h),Point(o+w*2,o),// lower spike
Point(o + w*2 + h,o+w ),Point(o + w*2,o+w*2),Simsun; Font-size:16px; line-height:24px">// right spike
{o +w,o+w*2+h},{o,o+w*2},Simsun; Font-size:16px; line-height:24px">// top spike
{o -h,o+w},o},Simsun; Font-size:16px; line-height:24px">// left spike
};
draw->drawpolygon(star,sizeof(star)/sizeof(star[0]),0.0),Simsun; Font-size:16px; line-height:24px">// star poly (doesn't trigger BUG... order is important un tesselation is supported.
//画星
const float o=180;
Point(o,Point(o+w,Simsun; Font-size:16px; line-height:24px">Point(o +w,o+w*2+h),Point(o,Simsun; Font-size:16px; line-height:24px">Point(o -h,o+w),Simsun; Font-size:16px; line-height:24px">// Draw segment
画直线,可加粗
draw->drawSegment(Point(20,s.height),Point(20,10,Simsun; Font-size:16px; line-height:24px">draw->drawSegment(Point(10,Point(s.wIDth/2,40,0.5));
// Draw triangle
画三角形
draw->drawTriangle(Point(10,10),Point(70,30),Point(100,140),Simsun; Font-size:16px; line-height:24px">// Draw some bezIErs
画二次方程的贝塞尔曲线
draw->drawQuadraticBezIEr(Point(s.wIDth - 150,s.height - 150),Point(s.wIDth - 70,s.height - 10),Point(s.wIDth - 10,Simsun; Font-size:16px; line-height:24px">画三次方程的贝塞尔曲线
draw->drawCubicBezIEr(Point(s.wIDth - 250,40),100),Point(s.wIDth - 30,250),s.height - 50),0.5)); 总结

以上是内存溢出为你收集整理的寒風的Cocos之旅之C++篇---drawNode用法全部内容,希望文章能够帮你解决寒風的Cocos之旅之C++篇---drawNode用法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1072470.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存