title: cocos2d-x 3 batch drawing explained
body: <p>I have read <a href="http://www.cocos2d-x.org/wiki/Texture_Cache" rel="nofollow">this page</a> to understand batch drawing details, but I still have questions. I know that in order to reduce draw call number we need to use batch drawing. I use it like this:</p>
  
  <pre><code>auto spritebatch = SpriteBatchNode::create("ingame.png");
  SpriteFrameCache::getInstance()-&gt;addSpriteFramesWithFile("ingame.plist");
  </code></pre>
  
  <p>And now I need to create a Sprite I have to do this:</p>
  
  <pre><code>auto backgroundSprite = Sprite::createWithSpriteFrameName("back_gradient.png");
  spritebatch-&gt;addChild(backgroundSprite);
  </code></pre>
  
  <p>But I don't understand the following things:</p>
  
  <ol>
  <li>What if my game has several spritesheets. For example I have HUD spritesheet and ingame spritesheet. Now if I want to show ingame screen with HUD then I need to create 2 <code>SpriteBatchNode</code>? and add them into ingame layer?</li>
  <li><p>What if the same spritesheet should be used in different Scenes. Should I do the following again?</p>
  
  <p>auto spritebatch = SpriteBatchNode::create("ingame.png");
  SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ingame.plist");</p></li>
  <li><p>What if I use sprites with <code>Button</code>, <code>TextEdit</code>, <code>Label</code> and other UI elements. </p>
  
  <ul>
  <li>First of all can I initialize Button state images from spritesheet?</li>
  <li>As I know I cannot add UI element as a child to <code>SpriteBatchNode</code>. In this case how to combile UI elements and sprite in the same view/scene?</li>
  </ul></li>
  </ol>
  
  <p>Sorry for lots of questions. But the fact is that I could not find any resource that contains the explanations to this questions. While they are all related. If you don't know answers to these questions, you don't know how to use <code>SpriteBatchNode</code>.</p>