Package com.badlogic.gdx.graphics.g2d

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


    public void control(Control control, String entity) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public float calcWidth(String s, String font) {
        BitmapFont myFont = new BitmapFont(Gdx.files.internal("data/font/" + font + ".fnt"), Gdx.files.internal("data/font/" + font + ".png"), false); //TODO: change the font/size
        float res = myFont.getBounds(s).width;
        return res;
    }
View Full Code Here


            }
        }
    }

    public float calcWidth(String s, String font) {
        BitmapFont myFont = new BitmapFont(Gdx.files.internal("data/font/" + font + ".fnt"), Gdx.files.internal("data/font/" + font + ".png"), false); //TODO: change the font/size
        float res = myFont.getBounds(s).width;
        return res;
    }
View Full Code Here

    public void addTextEntity(String name, WorldTextEntity entity) {
        m_worldTextEntities.put(name, entity);
    }

    public float calcWidth(String s, String font) {
        BitmapFont myFont = new BitmapFont(Gdx.files.internal("data/font/" + font + ".fnt"), Gdx.files.internal("data/font/" + font + ".png"), false); //TODO: change the font/size
        float res = myFont.getBounds(s).width;
        return res;
    }
View Full Code Here

    @Override
    public void stopContact(String firstEntity, String secondEntity, Vector2D normal, Vector2D point) {
    }

    public float calcWidth(String s, String font) {
        BitmapFont myFont = new BitmapFont(Gdx.files.internal("data/font/" + font + ".fnt"), Gdx.files.internal("data/font/" + font + ".png"), false); //TODO: change the font/size
        float res = myFont.getBounds(s).width;
        return res;
    }
View Full Code Here

            }
        }
    }

    public float calcWidth(String s, String font) {
        BitmapFont myFont = new BitmapFont(Gdx.files.internal("data/font/" + font + ".fnt"), Gdx.files.internal("data/font/" + font + ".png"), false); //TODO: change the font/size
        float res = myFont.getBounds(s).width;
        return res;
    }
View Full Code Here

    // Rocket
    texWeapons[3] = new TextureRegion(texture,147,0,8,16);
    // Laser
    texWeapons[4] = new TextureRegion(texture,156,0,2,8);
   
    font = new BitmapFont(Gdx.files.internal("data/arial12.fnt"),
             Gdx.files.internal("data/arial12.png"), false);
  }
View Full Code Here

    return items;
  }

  public void layout () {
    Drawable bg = style.background;
    BitmapFont font = style.font;

    prefHeight = Math.max(bg.getTopHeight() + bg.getBottomHeight() + font.getCapHeight() - font.getDescent() * 2,
      bg.getMinHeight());

    float maxItemWidth = 0;
    for (int i = 0; i < items.size; i++)
      maxItemWidth = Math.max(font.getBounds(items.get(i).toString()).width, maxItemWidth);

    prefWidth = bg.getLeftWidth() + bg.getRightWidth() + maxItemWidth;

    ListStyle listStyle = style.listStyle;
    ScrollPaneStyle scrollStyle = style.scrollStyle;
View Full Code Here

      background = style.backgroundOpen;
    else if (clickListener.isOver() && style.backgroundOver != null)
      background = style.backgroundOver;
    else
      background = style.background;
    final BitmapFont font = style.font;
    final Color fontColor = (disabled && style.disabledFontColor != null) ? style.disabledFontColor : style.fontColor;

    Color color = getColor();
    float x = getX();
    float y = getY();
    float width = getWidth();
    float height = getHeight();

    batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
    background.draw(batch, x, y, width, height);
    T selected = this.selected != null ? this.selected : selection.first();
    if (selected != null) {
      float availableWidth = width - background.getLeftWidth() - background.getRightWidth();
      String string = selected.toString();
      int numGlyphs = font.computeVisibleGlyphs(string, 0, string.length(), availableWidth);
      bounds.set(font.getBounds(string));
      height -= background.getBottomHeight() + background.getTopHeight();
      float textY = (int)(height / 2 + background.getBottomHeight() + bounds.height / 2);
      font.setColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a * parentAlpha);
      font.draw(batch, string, x + background.getLeftWidth(), y + textY, 0, numGlyphs);
    }
  }
View Full Code Here

   * @param characters the characters the font should contain
   * @param flip whether to flip the font horizontally, see {@link BitmapFont#BitmapFont(FileHandle, TextureRegion, boolean)}
   * @deprecated use {@link #generateFont(FreeTypeFontParameter)} instead */
  public BitmapFont generateFont (int size, String characters, boolean flip) {
    FreeTypeBitmapFontData data = generateData(size, characters, flip, null);
    BitmapFont font = new BitmapFont(data, data.getTextureRegions(), false);
    font.setOwnsTexture(true);
    return font;
  }
View Full Code Here

   * be generated. Using big sizes might cause such an exception. All characters need to fit onto a single texture.
   *
   * @param parameter configures how the font is generated */
  public BitmapFont generateFont (FreeTypeFontParameter parameter) {
    FreeTypeBitmapFontData data = generateData(parameter);
    BitmapFont font = new BitmapFont(data, data.getTextureRegions(), false);
    font.setOwnsTexture(true);
    return font;
  }
View Full Code Here

TOP

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

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.