Example #1
0
  @Override
  protected void doLayout(float width, float height) {
    float x = PADDING;
    float y = PADDING;
    float fieldHeight = txtPlayerName.getHeight();
    float avatarSize = 2 * fieldHeight + PADDING;
    float dy = fieldHeight + PADDING;

    avatarLabel.setBounds(x, y, avatarSize, avatarSize);
    x += avatarSize + PADDING;
    float w = width - x - fieldHeight - 2 * PADDING;
    txtPlayerName.setBounds(x, y, w, fieldHeight);
    x += w + PADDING;
    nameRandomiser.setBounds(x, y, fieldHeight, fieldHeight);

    y += dy;
    humanAiSwitch.setSize(humanAiSwitch.getAutoSizeWidth(fieldHeight), fieldHeight);
    x = width - humanAiSwitch.getWidth() - PADDING;
    humanAiSwitch.setPosition(x, y);
    w = x - avatarSize - 3 * PADDING;
    x = avatarSize + 2 * PADDING;
    if (cbArchenemyTeam.isVisible()) {
      cbArchenemyTeam.setBounds(x, y, w, fieldHeight);
    } else {
      cbTeam.setBounds(x, y, w, fieldHeight);
    }

    y += dy;
    x = PADDING;
    w = width - 2 * PADDING;
    if (btnCommanderDeck.isVisible()) {
      btnCommanderDeck.setBounds(x, y, w, fieldHeight);
      y += dy;
    } else if (btnTinyLeadersDeck.isVisible()) {
      btnTinyLeadersDeck.setBounds(x, y, w, fieldHeight);
      y += dy;
    } else if (btnDeck.isVisible()) {
      btnDeck.setBounds(x, y, w, fieldHeight);
      y += dy;
    }
    if (btnSchemeDeck.isVisible()) {
      btnSchemeDeck.setBounds(x, y, w, fieldHeight);
      y += dy;
    }
    if (btnPlanarDeck.isVisible()) {
      btnPlanarDeck.setBounds(x, y, w, fieldHeight);
      y += dy;
    }
    if (btnVanguardAvatar.isVisible()) {
      btnVanguardAvatar.setBounds(x, y, w, fieldHeight);
    }
  }
Example #2
0
 public float getPreferredHeight() {
   int rows = 3;
   if (!btnDeck.isVisible()) {
     rows--;
   }
   if (btnCommanderDeck.isVisible() || btnTinyLeadersDeck.isVisible()) {
     rows++;
   }
   if (btnSchemeDeck.isVisible()) {
     rows++;
   }
   if (btnPlanarDeck.isVisible()) {
     rows++;
   }
   if (btnVanguardAvatar.isVisible()) {
     rows++;
   }
   return rows * (txtPlayerName.getHeight() + PADDING) + PADDING;
 }