Beispiel #1
0
  @Override
  public void drawLevel(Level level) {
    int baseX = 0;
    int baseY = Client.UI_SIZE;

    for (int x = 0; x < level.getDimensions().x; x++) {
      for (int y = 0; y < level.getDimensions().y; y++) {

        ResourceManager.bindTexture(level.getTileType(x, y));
        drawSprite(baseX, baseY, Client.PIXELS_PER_TILE, Client.PIXELS_PER_TILE);

        Tower tower = level.getTower(x, y);
        if (tower != null) {
          ResourceManager.bindTower(tower.getTowerType());
          drawSprite(baseX, baseY, Client.PIXELS_PER_TILE, Client.PIXELS_PER_TILE);
        }

        baseY += Client.PIXELS_PER_TILE;
      }
      baseY = Client.UI_SIZE;
      baseX += Client.PIXELS_PER_TILE;
    }

    drawUnits(level);
  }
Beispiel #2
0
  @Override
  public void drawUI() {
    int baseX = 0;
    int baseY = 0;

    ResourceManager.bindUIElement(GUI.GUIElements.BACKGROUND);
    for (int i = 0; i < screenWidth / Client.UI_SIZE; i++) {
      drawSprite(baseX, baseY, Client.UI_SIZE, Client.UI_SIZE);

      baseX += Client.UI_SIZE;
    }

    baseX = 0;

    for (int i = 0; i < GUI.guiTowerElements.length; i++) {

      if (GUI.guiTowerElements[i] == null) {
        baseX += Client.UI_SIZE;
        continue;
      }

      ResourceManager.bindTower(GUI.guiTowerElements[i]);
      drawSprite(baseX, baseY, Client.UI_SIZE, Client.UI_SIZE);

      baseX += Client.UI_SIZE;
    }

    for (int i = 0; i < GUI.guiUnitElements.length; i++) {

      if (GUI.guiUnitElements[i] == null) {
        baseX += Client.UI_SIZE;
        continue;
      }

      ResourceManager.bindUnit(GUI.guiUnitElements[i]);
      drawSprite(baseX, baseY, Client.UI_SIZE, Client.UI_SIZE);

      baseX += Client.UI_SIZE;
    }
  }