• <small id='sfAB5'></small><noframes id='sfAB5'>

      <bdo id='sfAB5'></bdo><ul id='sfAB5'></ul>

  • <i id='sfAB5'><tr id='sfAB5'><dt id='sfAB5'><q id='sfAB5'><span id='sfAB5'><b id='sfAB5'><form id='sfAB5'><ins id='sfAB5'></ins><ul id='sfAB5'></ul><sub id='sfAB5'></sub></form><legend id='sfAB5'></legend><bdo id='sfAB5'><pre id='sfAB5'><center id='sfAB5'></center></pre></bdo></b><th id='sfAB5'></th></span></q></dt></tr></i><div id='sfAB5'><tfoot id='sfAB5'></tfoot><dl id='sfAB5'><fieldset id='sfAB5'></fieldset></dl></div>
  • <tfoot id='sfAB5'></tfoot>
    <legend id='sfAB5'><style id='sfAB5'><dir id='sfAB5'><q id='sfAB5'></q></dir></style></legend>

        绘制 cocos2d v3 不再有 ccDraw* 功能,不制作节点如何绘制?

        时间:2024-04-14
          <legend id='m9SCd'><style id='m9SCd'><dir id='m9SCd'><q id='m9SCd'></q></dir></style></legend>
            • <bdo id='m9SCd'></bdo><ul id='m9SCd'></ul>

                <i id='m9SCd'><tr id='m9SCd'><dt id='m9SCd'><q id='m9SCd'><span id='m9SCd'><b id='m9SCd'><form id='m9SCd'><ins id='m9SCd'></ins><ul id='m9SCd'></ul><sub id='m9SCd'></sub></form><legend id='m9SCd'></legend><bdo id='m9SCd'><pre id='m9SCd'><center id='m9SCd'></center></pre></bdo></b><th id='m9SCd'></th></span></q></dt></tr></i><div id='m9SCd'><tfoot id='m9SCd'></tfoot><dl id='m9SCd'><fieldset id='m9SCd'></fieldset></dl></div>

                  <small id='m9SCd'></small><noframes id='m9SCd'>

                    <tbody id='m9SCd'></tbody>
                  <tfoot id='m9SCd'></tfoot>
                • 本文介绍了绘制 cocos2d v3 不再有 ccDraw* 功能,不制作节点如何绘制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我按照 http://www.cocos2d-swift.org/get-started 上的说明进行操作

                  并通过 Sprite Builder 创建了一个新项目.

                  and made a new Project through Sprite Builder.

                  搜索 ccDraw 没有显示任何内容.我在论坛上找到了这个例子,并实现了,但它看起来不正确.我不想要一个对资源征税的drawNode.我想要 ccDrawLine 过去如何工作的低级 GL 绘图线.当我做这样的 drawNode 时——它不会重置旧的绘图——所以我画的所有线条都留在屏幕上.

                  searching for ccDraw doesn't show anything. I found this example on a forum, and implemented, but it doesn't look right. I don't want a drawNode that taxes resources. I want low level GL drawing line how ccDrawLine used to work. When I do a drawNode like this -- it doesn't reset the old drawing -- so all lines I draw stay on the screen.

                  如何像在 v2.x 中一样进行绘制?(ccDrawLine, ccDrawCircle, ccDrawPoly)

                  How do I draw like in v2.x? (ccDrawLine, ccDrawCircle, ccDrawPoly)

                  #import "MainScene.h"
                  
                  @implementation MainScene
                  
                  - (id)init {
                      self = [super init];
                      _line01 = [CCDrawNode node];
                      [self addChild:_line01];
                      [self schedule:@selector(pulse) interval:0.016];
                      return self;
                  }
                  
                  - (void)draw:(CCRenderer *)renderer transform:(const GLKMatrix4 *)transform {
                      [_line01 drawSegmentFrom:ccp(50, 50) to:ccp(x, y) radius:2 color:[CCColor colorWithRed:128 green:25/255 blue:3]];
                  }
                  
                  - (void)pulse {
                      x+= 1;
                      y+= 3;
                      if (x > 500) {
                          x = 0;
                      } else if (y > 500) {
                          y = 0;
                      }
                  }
                  
                  @end
                  

                  http://www.cocos2d-swift.org/docs/api/Classes/CCDrawNode.html 建议使用 CCDrawNode 效率不高.

                  http://www.cocos2d-swift.org/docs/api/Classes/CCDrawNode.html suggests using a CCDrawNode is not efficient.

                  推荐答案

                  简单修改pulse如下,去掉draw覆盖.

                  simply modify pulse slightly as follows, and get rid of the draw override.

                  - (void)pulse {
                      x+= 1;
                      y+= 3;
                      if (x > 500) {
                          x = 0;
                      } else if (y > 500) {
                          y = 0;
                      }
                      // update the line segment
                      [_line01 clear];
                      [_line01 drawSegmentFrom:ccp(50, 50) to:ccp(x, y) radius:2 color:[CCColor colorWithRed:128 green:25/255 blue:3]];
                  
                  }
                  

                  这篇关于绘制 cocos2d v3 不再有 ccDraw* 功能,不制作节点如何绘制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:IOS,ARC,属性:(readwrite,nonatomic)vs(radwrite,retain,nonatomic 下一篇:在 Cocos2d 中使用自定义字体

                  相关文章

                  <tfoot id='o1awM'></tfoot>

                  <small id='o1awM'></small><noframes id='o1awM'>

                  <i id='o1awM'><tr id='o1awM'><dt id='o1awM'><q id='o1awM'><span id='o1awM'><b id='o1awM'><form id='o1awM'><ins id='o1awM'></ins><ul id='o1awM'></ul><sub id='o1awM'></sub></form><legend id='o1awM'></legend><bdo id='o1awM'><pre id='o1awM'><center id='o1awM'></center></pre></bdo></b><th id='o1awM'></th></span></q></dt></tr></i><div id='o1awM'><tfoot id='o1awM'></tfoot><dl id='o1awM'><fieldset id='o1awM'></fieldset></dl></div>
                    <bdo id='o1awM'></bdo><ul id='o1awM'></ul>

                  1. <legend id='o1awM'><style id='o1awM'><dir id='o1awM'><q id='o1awM'></q></dir></style></legend>