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

        • <bdo id='X4Zf5'></bdo><ul id='X4Zf5'></ul>

      1. <small id='X4Zf5'></small><noframes id='X4Zf5'>

        如何用 Cocos2d-iPhone 画线

        时间:2024-08-12

          • <bdo id='zE208'></bdo><ul id='zE208'></ul>

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

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

                • <legend id='zE208'><style id='zE208'><dir id='zE208'><q id='zE208'></q></dir></style></legend>
                  本文介绍了如何用 Cocos2d-iPhone 画线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我试图通过完成简单的事情来掌握 Cocos2d.此时,我有一个场景,该场景有一个背景精灵和一个图层.我正在尝试使用 drawLine 绘制到图层上.这是我目前的尝试.

                  I'm trying to get to grips with Cocos2d by trying to accomplish simple things. At this point, I have a scene, that scene has a background sprite, and a Layer. I'm trying to draw onto the Layer using drawLine. Here's my current attempt.

                  @implementation MyLayer
                  -(id)init{
                      self = [super init];
                      if(self != nil){
                          glColor4f(0.8, 1.0, 0.76, 1.0);  
                          glLineWidth(2.0f);
                          CocosNode *line = drawLine(10.0f, 100.0f,400.0f,27.0f);
                          [self addChild:line z:1];
                      }
                      return self;
                  }
                  @end
                  

                  这会产生错误空值没有被忽略,因为它应该是".所以很明显我做错了,但希望你能看到我的推理.

                  Which generates the error "void value not ignored as it ought to be". So obviously I'm doing it wrong, but hopefully you can see my reasoning.

                  我也试过了

                  -(id)init{
                      self = [super init];
                      if(self != nil){
                          glColor4f(0.8, 1.0, 0.76, 1.0);  
                          glLineWidth(2.0f);
                          drawLine(10.0f, 100.0f,400.0f,27.0f);
                      }
                      return self;
                  }
                  

                  这不会给我一个错误,但它也不起作用.我意识到我没有理解一些基本的东西,但是谁能引导我朝着正确的方向前进?

                  Which doesn't give me an error, but it doesn't work either. I realise I'm not understanding something fundamental, but can anyone steer me in the right direction?

                  推荐答案

                  来自cocos2d drawPrimitivesTest.m:

                  From the cocos2d drawPrimitivesTest.m:

                  - (void)draw {
                    // ...
                  
                    // draw a simple line
                    // The default state is:
                    // Line Width: 1
                    // color: 255,255,255,255 (white, non-transparent)
                    // Anti-Aliased
                    glEnable(GL_LINE_SMOOTH);
                    ccDrawLine( ccp(0, 0), ccp(s.width, s.height) );
                  
                    // ...
                  }
                  

                  这篇关于如何用 Cocos2d-iPhone 画线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何让对象对 Cocos2D 中的触摸做出反应? 下一篇:UIScrollView 和 Cocos2D

                  相关文章

                  <legend id='z4K8R'><style id='z4K8R'><dir id='z4K8R'><q id='z4K8R'></q></dir></style></legend>

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

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