Пример #1
0
  private void drawGrid() {
    int height = GdxController.getInstance().getMapGdx().getForeground().getHeight();
    int width = GdxController.getInstance().getMapGdx().getForeground().getWidth();

    shapeRenderer.begin(ShapeType.Line);
    shapeRenderer.setColor(Color.RED);
    for (int i = 0; i < 50; i++) {
      shapeRenderer.line(0.0f, i * 32.0f, width * 32.0f, i * 32.0f);
      shapeRenderer.line(i * 32.0f, 0.0f, i * 32.0f, height * 32.0f);
    }
    shapeRenderer.end();
  }
Пример #2
0
  private void drawEnemyState(SpriteBatch batch) {
    for (Enemy enemy : GameController.getInstance().getEnemiesMap().values()) {
      IEnemyState state =
          GdxController.getInstance().getEnemyGdx().getStateMap().get(enemy.getId());

      GlyphLayout glyphLayout = new GlyphLayout();
      String item = state.getClass().getSimpleName();
      glyphLayout.setText(font, item);
      Float fwidth = glyphLayout.width;

      font.draw(
          batch,
          item,
          enemy.getX() + enemy.getWidth() / 2 - fwidth / 2,
          enemy.getY() + enemy.getHeight() + font.getCapHeight());
    }
  }