title: Libgdx - How to draw filled rectangle in the right place in scene2d?
body: <p>I am using scene2d. Here is my code:</p>
  <pre class="lang-java prettyprint-override"><code>group.addActor(new Actor() {
  
      @Override
      public Actor hit(float arg0, float arg1) {
          return null;
      }
  
      @Override
      public void draw(SpriteBatch batch, float arg1) {
          batch.end();
          shapeRenderer.begin(ShapeType.FilledRectangle);
          shapeRenderer.setColor(Color.RED);
          shapeRenderer.filledRect(0, 0, 300, 20);
          shapeRenderer.end();
          batch.begin();
      }
  });
  </code></pre>
  <p>The problem is that it draws this rectangular relative to <em>screen</em> (x = 0, y = 0), but I need it to be drawn relative to my <em>group</em>. But if I draw other entities with:</p>
  <pre class="lang-java prettyprint-override"><code>batch.draw(texture, 0, 0, width, height);
  </code></pre>
  <p>it correctly draws at (x = 0, y = 0) relative my group (0,0 pixels from left-bottom corner of the group).</p>
  <p>Any suggestions how can I implement shape drawing in scene2d? And can someone can explain why these two calls work differently?</p>