private void renderHP() {
    ShapeRenderer render = new ShapeRenderer();

    int hp = world.thePlayer.hp;

    if (hp >= 50) render.setColor(0.0f, 1.0f, 0.0f, 1);
    else if (hp > 33) render.setColor(1.0f, 1.0f, 0.0f, 1);
    else if (hp > 0) render.setColor(1.0f, 0.0f, 0.0f, 1);

    if (!(hp < 33)) {
      render.begin(ShapeRenderer.ShapeType.FilledRectangle);
      render.filledRect(5, 5, hp * 2, 20);
      render.end();
    }

    if (flickerDraw && (hp < 33)) {
      render.begin(ShapeRenderer.ShapeType.FilledRectangle);
      render.filledRect(5, 5, hp * 2, 20);
      render.end();
      flickerDraw = false;
    } else if (lastFlicker > 3) {
      flickerDraw = true;
      this.lastFlicker = 0;
    } else this.lastFlicker++;
  }
  public void cleanBorders() {
    shapeRenderer.begin(ShapeType.FilledRectangle);
    shapeRenderer.setColor(Color.BLACK);
    shapeRenderer.filledRect(0, 0, border - 1, Sizes.DEFAULT_WORLD_HEIGHT * ppux);
    shapeRenderer.filledRect(
        border + Sizes.DEFAULT_WORLD_WIDTH * ppux,
        0,
        2 * border + Sizes.DEFAULT_WORLD_WIDTH * ppux,
        Sizes.DEFAULT_WORLD_HEIGHT * ppux);

    shapeRenderer.end();
  }
Exemple #3
0
  @Override
  public void render(float arg0) {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    camera.update();
    if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
      if (focused) {
        focused = false;
      } else {
        goBack();
      }
    }

    if (focused) {
      shapeRenderer.begin(ShapeType.FilledRectangle);
      Color c = new Color(0.15f, 0.4f, 0.15f, 1f);
      shapeRenderer.setColor(c);
      shapeRenderer.filledRect(focusedBox.x, focusedBox.y, focusedBox.width, focusedBox.height);
      shapeRenderer.end();
    }

    batch.begin();
    ObjectMap.Entries<String, Rectangle> it = bindingButtons.entries();
    // draw back button text
    font.draw(batch, "Back", backButton.x, backButton.y + backButton.height);
    // draw option texts
    while (it.hasNext()) {
      ObjectMap.Entry<String, Rectangle> entry = it.next();
      Rectangle bounds = entry.value;
      font.draw(batch, entry.key, bounds.x, bounds.y + bounds.height);
      Binding binding = game.getBindings().get(entry.key);
      font.draw(batch, binding.character, bounds.x + 200.0f, bounds.y + bounds.height);
    }
    batch.end();
  }
 @Override
 public void render(float delta) {
   Gdx.gl.glEnable(GL10.GL_BLEND);
   if (null != snapPoint) {
     render.begin(ShapeType.FilledRectangle);
     render.setColor(Color.BLUE);
     render.filledRect(snapPoint.x - 5, snapPoint.y - 5, 2 * 5, 2 * 5);
     render.end();
   }
   Gdx.gl.glDisable(GL10.GL_BLEND);
 }
Exemple #5
0
  public void render() {
    shapeRenderer.begin(ShapeType.FilledRectangle);
    shapeRenderer.setColor(color);
    shapeRenderer.filledRect(x, y, width, height);
    shapeRenderer.end();

    shapeRenderer.begin(ShapeType.FilledCircle);
    shapeRenderer.setColor(1.0f, 0.0f, 0.0f, 1.0f);
    shapeRenderer.filledCircle(x, y, 3);
    shapeRenderer.end();
  }
Exemple #6
0
 @Override
 public void render(float delta) {
   Gdx.gl.glEnable(GL10.GL_BLEND);
   if (currentPoint == 1) {
     float width = secondPoint.x - firstPoint.x;
     float height = secondPoint.y - firstPoint.y;
     if (Math.abs(width) > 0 && Math.abs(height) > 0) {
       render.setColor(new Color(1, 1, 1, 0.4f));
       render.begin(ShapeType.FilledRectangle);
       render.filledRect(firstPoint.x, firstPoint.y, width, height);
       render.end();
     }
   }
   Gdx.gl.glDisable(GL10.GL_BLEND);
 }