Ejemplo n.º 1
0
 @Override
 public void drawBackground(Batch batch, float parentAlpha) {
   batch.draw(
       background,
       parent.getX() + backgroundPos.x,
       parent.getY() + backgroundPos.y,
       parent.getWidth(),
       parent.getHeight());
 }
Ejemplo n.º 2
0
  @Override
  public void draw(Batch batch, float parentAlpha) {
    batch.draw(
        reorganize.get(),
        parent.getX() + reorganizePos.x,
        parent.getY() + reorganizePos.y,
        reorganizePos.width,
        reorganizePos.height);
    batch.draw(
        newMilitary.get(),
        parent.getX() + newMilitaryPos.x,
        parent.getY() + newMilitaryPos.y,
        newMilitaryPos.width,
        newMilitaryPos.height);
    batch.draw(
        recruit.get(),
        parent.getX() + recruitPos.x,
        parent.getY() + recruitPos.y,
        recruitPos.width,
        recruitPos.height);
    batch.draw(
        training.get(),
        parent.getX() + trainingPos.x,
        parent.getY() + trainingPos.y,
        trainingPos.width,
        trainingPos.height);
    batch.draw(
        merge.get(),
        parent.getX() + mergePos.x,
        parent.getY() + mergePos.y,
        mergePos.width,
        mergePos.height);
    batch.draw(
        disband.get(),
        parent.getX() + disbandPos.x,
        parent.getY() + disbandPos.y,
        disbandPos.width,
        disbandPos.height);
    batch.draw(
        upgrade.get(),
        parent.getX() + upgradePos.x,
        parent.getY() + upgradePos.y,
        upgradePos.width,
        upgradePos.height);

    for (TextWidget<ArchitectureCommandFrame.TextType> textWidget : textWidgets) {
      textWidget.setPosition(
          textWidget.getExtra().position.x + parent.getX(),
          textWidget.getExtra().position.y + parent.getY());
      if (textWidget.getExtra().staticText) {
        textWidget.setText(textWidget.getExtra().name);
      } else {
        textWidget.setText(
            parent.getCurrentArchitecture().getFieldString(textWidget.getExtra().name));
      }
      textWidget.draw(batch, parentAlpha);
    }

    if (militaryBottomPane == null) {
      initMilitaryBottomPane();
    }
    if (militaryTopPane == null) {
      initMilitaryTopPane();
    }

    if (currentMilitary != null) {
      batch.end();

      shapeRenderer.begin(ShapeRenderer.ShapeType.Line);

      shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
      shapeRenderer.setTransformMatrix(batch.getTransformMatrix());

      shapeRenderer.setColor(selectedBorderColor);
      shapeRenderer.rect(
          parent.getX() + currentMilitaryPos.getX(),
          parent.getY() + currentMilitaryPos.getY(),
          currentMilitaryPos.getWidth(),
          currentMilitaryPos.getHeight());

      shapeRenderer.end();

      batch.begin();
    }
  }