コード例 #1
0
  /**
   * Manages rendering the menu.
   *
   * @param batch the spritebatch to use.
   * @param patch the ninepatch to use.
   */
  @Override
  public void render(SpriteBatch batch, NinePatch patch) {
    float leftX = x + 20;
    float rightX = x + (width / 2) + 20;
    float thisY = y;

    patch.draw(batch, x, y, width, height + (paddingY * 2));

    for (int i = 0; i < listItems.size(); i++) {
      if (i % 2 == 0) {
        if (i == selected) {
          renderText(batch, ">", leftX - 20, thisY, Color.WHITE, Assets.consolas22);
          renderText(batch, listItems.get(i), leftX, thisY, Color.WHITE, Assets.consolas22);
        } else
          renderText(batch, listItems.get(i), leftX, thisY, Color.LIGHT_GRAY, Assets.consolas22);
      } else {
        if (i == selected) {
          renderText(batch, ">", rightX - 20, thisY, Color.WHITE, Assets.consolas22);
          renderText(batch, listItems.get(i), rightX, thisY, Color.WHITE, Assets.consolas22);
        } else
          renderText(batch, listItems.get(i), rightX, thisY, Color.LIGHT_GRAY, Assets.consolas22);

        thisY -= 25;
      }
    }
  }
コード例 #2
0
ファイル: TextBox.java プロジェクト: Evamonavan/libGDXTests
 @Override
 public void setColor(Color color) {
   background.setColor(color);
 }