Package com.badlogic.gdx.graphics.g2d.BitmapFont

Examples of com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData


  private float addToCache (CharSequence str, float x, float y, int start, int end) {
    float startX = x;
    BitmapFont font = this.font;
    Glyph lastGlyph = null;
    BitmapFontData data = font.data;
    if (data.scaleX == 1 && data.scaleY == 1) {
      while (start < end) {
        lastGlyph = data.getGlyph(str.charAt(start++));
        if (lastGlyph != null) {
          addGlyph(lastGlyph, x + lastGlyph.xoffset, y + lastGlyph.yoffset, lastGlyph.width, lastGlyph.height);
          x += lastGlyph.xadvance;
          break;
        }
      }
      while (start < end) {
        char ch = str.charAt(start++);
        Glyph g = data.getGlyph(ch);
        if (g != null) {
          x += lastGlyph.getKerning(ch);
          lastGlyph = g;
          addGlyph(lastGlyph, x + g.xoffset, y + g.yoffset, g.width, g.height);
          x += g.xadvance;
        }
      }
    } else {
      float scaleX = data.scaleX, scaleY = data.scaleY;
      while (start < end) {
        lastGlyph = data.getGlyph(str.charAt(start++));
        if (lastGlyph != null) {
          addGlyph(lastGlyph, //
            x + lastGlyph.xoffset * scaleX, //
            y + lastGlyph.yoffset * scaleY, //
            lastGlyph.width * scaleX, //
            lastGlyph.height * scaleY);
          x += lastGlyph.xadvance * scaleX;
          break;
        }
      }
      while (start < end) {
        char ch = str.charAt(start++);
        Glyph g = data.getGlyph(ch);
        if (g != null) {
          x += lastGlyph.getKerning(ch) * scaleX;
          lastGlyph = g;
          addGlyph(lastGlyph, //
            x + g.xoffset * scaleX, //
View Full Code Here


    Array<AssetDescriptor> deps = new Array<AssetDescriptor>();
    if (parameter != null && parameter.bitmapFontData != null) {
      data = parameter.bitmapFontData;
      return deps;
    }
    data = new BitmapFontData(file, parameter != null ? parameter.flip : false);
    for (int i=0; i<data.getImagePaths().length; i++) {
      deps.add(new AssetDescriptor(data.getImagePath(i), Texture.class));
    }
    return deps;
  }
View Full Code Here

  private float addToCache (CharSequence str, float x, float y, int start, int end) {
    float startX = x;
    BitmapFont font = this.font;
    Glyph lastGlyph = null;
    BitmapFontData data = font.data;
    if (data.scaleX == 1 && data.scaleY == 1) {
      while (start < end) {
        char ch = str.charAt(start++);
        if (ch == '[' && font.markupEnabled) {
          if (!(start < end && str.charAt(start) == '[')) { // non escaped '['
            start += parseAndSetColor(str, start, end) + 1;
            continue;
          }
          start++;
        }
        lastGlyph = data.getGlyph(ch);
        if (lastGlyph != null) {
          addGlyph(lastGlyph, x + lastGlyph.xoffset, y + lastGlyph.yoffset, lastGlyph.width, lastGlyph.height);
          x += lastGlyph.xadvance;
          break;
        }
      }
      while (start < end) {
        char ch = str.charAt(start++);
        if (ch == '[' && font.markupEnabled) {
          if (!(start < end && str.charAt(start) == '[')) { // non escaped '['
            start += parseAndSetColor(str, start, end) + 1;
            continue;
          }
          start++;
        }
        Glyph g = data.getGlyph(ch);
        if (g != null) {
          x += lastGlyph.getKerning(ch);
          lastGlyph = g;
          addGlyph(lastGlyph, x + g.xoffset, y + g.yoffset, g.width, g.height);
          x += g.xadvance;
        }
      }
    } else {
      float scaleX = data.scaleX, scaleY = data.scaleY;
      while (start < end) {
        char ch = str.charAt(start++);
        if (ch == '[' && font.markupEnabled) {
          if (!(start < end && str.charAt(start) == '[')) { // non escaped '['
            start += parseAndSetColor(str, start, end) + 1;
            continue;
          }
          start++;
        }
        lastGlyph = data.getGlyph(ch);
        if (lastGlyph != null) {
          addGlyph(lastGlyph, //
            x + lastGlyph.xoffset * scaleX, //
            y + lastGlyph.yoffset * scaleY, //
            lastGlyph.width * scaleX, //
            lastGlyph.height * scaleY);
          x += lastGlyph.xadvance * scaleX;
          break;
        }
      }
      while (start < end) {
        char ch = str.charAt(start++);
        if (ch == '[' && font.markupEnabled) {
          if (!(start < end && str.charAt(start) == '[')) { // non escaped '['
            start += parseAndSetColor(str, start, end) + 1;
            continue;
          }
          start++;
        }
        Glyph g = data.getGlyph(ch);
        if (g != null) {
          x += lastGlyph.getKerning(ch) * scaleX;
          lastGlyph = g;
          addGlyph(lastGlyph, //
            x + g.xoffset * scaleX, //
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.