在class HelloWorld : public cocos2d::CCLayer中添加

void draw();

实现:

void HelloWorld::draw()
{ CCSize s = CCDirector::sharedDirector()->getWinSize();
CCPointArray *array = CCPointArray::create(); array->addControlPoint(ccp(, ));
array->addControlPoint(ccp(, ));
array->addControlPoint(ccp(s.width - , ));
array->addControlPoint(ccp(s.width - , s.height - ));
array->addControlPoint(ccp(, s.height - ));
array->addControlPoint(ccp(, ));
array->addControlPoint(ccp(s.width / , s.height / )); CCPointArray *array2 = CCPointArray::create(); array2->addControlPoint(ccp(s.width / , ));
array2->addControlPoint(ccp(s.width -, ));
array2->addControlPoint(ccp(s.width - , s.height - ));
array2->addControlPoint(ccp(s.width / , s.height - ));
array2->addControlPoint(ccp(s.width / , ));
//个人理解是初始化用来存放点的栈
kmGLPushMatrix();
//定义栈的大小
kmGLTranslatef(, , );
//绘制曲线
ccDrawCatmullRom(array, );
//绘制完后弹出所存放的点
kmGLPopMatrix();
//由于上面只是弹出并不是释放,所以仍然可以通过点栈来绘制曲线
ccDrawCatmullRom(array2,);
}

然后直接运行就可以了

补充:

cocos2d-x画线的更多相关文章

  1. ios cocos2d 画线出现闪烁问题

    根据http://www.merowing.info/2012/04/drawing-smooth-lines-with-cocos2d-ios-inspired-by-paper/ 用cocos2d ...

  2. MFC画线功能总结

    本文仅用于学习交流,商业用途请支持正版!转载请注明:http://www.cnblogs.com/mxbs/p/6216464.html MFC画线功能要点有二:其一,鼠标按下时记录初始位置为线的起始 ...

  3. MFC消息映射机制以及画线功能实现

    ---此仅供用于学习交流,切勿用于商业用途,转载请注明http://www.cnblogs.com/mxbs/p/6213404.html. 利用VS2010创建一个单文档标准MFC工程,工程名为Dr ...

  4. CGContextRef 画线简单用法

    CGContextRef CGContextMoveToPoint(context,150,50);//圆弧的起始点 CGContextAddArcToPoint(context,100,80,130 ...

  5. Android中Path类的lineTo方法和quadTo方法画线的区别

    转载:http://blog.csdn.net/stevenhu_223/article/details/9229337 当我们需要在屏幕上形成画线时,Path类的应用是必不可少的,而Path类的li ...

  6. C#使用 DirectX SDK 9做视频播放器 并在视频画线添加文字 VMR9

    视频图像处理系列 索引 VS2013下测试通过. 在百度中搜索关键字“DirectX SDk”,或者进入微软官网https://www.microsoft.com/en-us/download/det ...

  7. iOS小画板画线总结

    一:基本画线: 使用贝赛尔曲线画: //创建路径 UIBezierPath* aPath = [UIBezierPath bezierPath]; //设置线宽 aPath.lineWidth = 5 ...

  8. [修复] Firemonkey 画线问题(Android & iOS 平台)

    问题:官方 QC 的一个 Firemonkey 移动平台画线问题: RSP-14309: [iOS & Android] Delphi 10.1 Berlin - drawing proble ...

  9. WPF画线问题,几千条以后就有明显的延迟了。

      我现在是这么画的,class A { private GeometryGroup _lines; private Path _path; public A() {    _path.Data = ...

  10. PHP合成图片、生成文字、居中对齐、画线、矩形、三角形、多边形、图片抗锯齿、不失真 高性能源码示例

    function generateImg($source, $text1, $text2, $text3, $font = './msyhbd.ttf') { $date = '' . date ( ...

随机推荐

  1. 页面载入时通过获取GridView某行某列的值来控制某一列的控件属性

    通过获取状态来控制"查看"button的Visible属性值. 在前台GridView中加入 OnRowDataBound="GridView1_RowDataBound ...

  2. 页面回到顶部的三种实现(锚标记,js)

    一.使用锚标记返回页面顶部 使用HTML锚标记最简单,就是看起来有点不好看,点击后会在地址栏显示这个锚标记,其它的倒没什么. 页面顶部放置: <a name="top" id ...

  3. JSON path

    https://github.com/itguang/gitbook-smile/blob/master/springboot-fastjson/fastjson%E4%B9%8BJSONPath%E ...

  4. servlet实现文件上传,预览,下载和删除

      一.准备工作 1.1 文件上传插件:uploadify: 1.2 文件上传所需jar包:commons-fileupload-1.3.1.jar和commons-io-2.2.jar 1.3 将数 ...

  5. FPGA视频拼接器的DP 的4k 功能输入, 把lvds 转为 serdes

    4k(3840 x 2160 @60hz)越来越成为一种视频趋势,怎样把4K 接入到拼接器中.是一个棘手的问题. 先看一下原理图的接口: 这是 anx1122的 lvds的接口. 以下看一下系统的框架 ...

  6. 去除DataTable重复数据的三种方法(转)

    转自:https://www.cnblogs.com/sunxi/p/4767577.html 业务需求 最近做一个把源数据库的数据批次导出到目标数据库.源数据库是采集程序采集而来的原始数据库,所以需 ...

  7. rarlinux基于linux-x64

    winrar在Win都吃香,在也linux也凄惨...  风萧萧兮易水寒,壮士一去兮不复还! 00.下载rarlinux wget http://www.rarlab.com/rar/rarlinux ...

  8. android API之android.text.TextWatcher

    When an object of a type is attached to an Editable, its methods will be called when the text is cha ...

  9. TScrollBox响应鼠标滚轮问题

    Delphi的TScrollBox本身并不响应鼠标滚轮事件(不知道为什么),但可以在ScrollBox的鼠标滚动事件中进行控制: procedure TfrmTaskNoteEdit.ScrollBo ...

  10. Jquery与mootools对比

    换了新公司以后就很少使用原生Js来实现界面交互了,而是更多的依赖Jquery. 1.Jquery优点: 良好的一致性$().().xxxxx与强大的DOM api组件可以让一个js菜鸟一周之类立马开发 ...