コード例 #1
0
  public void drawString(String s, float x, float y, float fontSize, boolean centered, Color col) {
    if (s == null) return;
    myTextureChecker.onString(myFont.getRegion().getTexture());
    myFont.setColor(col);
    myFont.getData().setScale(fontSize / myOrigFontHeight);
    if (!centered) {
      myFont.draw(mySpriteBatch, s, x, y);
      return;
    }

    // http://www.badlogicgames.com/wordpress/?p=3658
    layout.reset();
    layout.setText(myFont, s);
    x -= layout.width / 2;
    y -= layout.height / 2;
    myFont.draw(mySpriteBatch, layout, x, y);
  }
コード例 #2
0
 public void draw(
     TextureRegion tr,
     float width,
     float height,
     float origX,
     float origY,
     float x,
     float y,
     float rot,
     Color tint) {
   setTint(tint);
   if (tr instanceof TextureAtlas.AtlasRegion) {
     myTextureChecker.onReg((TextureAtlas.AtlasRegion) tr);
   } else {
     throw new AssertionError("Unexpected texture class");
   }
   mySpriteBatch.draw(tr, x - origX, y - origY, origX, origY, width, height, 1, 1, rot);
 }
コード例 #3
0
 public void end() {
   myTextureChecker.onEnd();
   mySpriteBatch.end();
 }
コード例 #4
0
 public SpriteBatch getBatch(Texture texture, TextureAtlas.AtlasRegion tex) {
   myTextureChecker.onSprite(texture, tex);
   return mySpriteBatch;
 }