Draw Quad and Cubic Bezier in Cocos2d v3 on IOS

五迷三道 提交于 2019-12-25 02:42:11

问题


I want to draw a Cubic/Quad Bezier with Cocos2d v3. I looked at CCDrawNode but no change. Does anyone know a way around? Thanks!!


回答1:


finally, I found the solution: https://github.com/njt1982/CCDrawNode-Bezier




回答2:


This is how I did it in Cocos2d 3.3:

// blue test
auto bluN = DrawNode::create();
//Draw a blue quadratic bezier curve
Color4F blue(0, 0, 1, 1);
bluN->drawCubicBezier(Vec2(0.0, 0.0), Vec2(_visibleSize.height, 0.0), Vec2(_visibleSize.height, _visibleSize.height), Vec2(0.0,_visibleSize.height), 18, blue);
_hudLayer->addChild(bluN);

This creates a perfect semi-circle (half-circle).

Chris



来源:https://stackoverflow.com/questions/25143084/draw-quad-and-cubic-bezier-in-cocos2d-v3-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!