Exemplo n.º 1
0
  @Override
  public void render(Camera camera, GameContainer gameContainer) {
    Graphics graphics = gameContainer.getGraphics();
    graphics.pushTransform();
    graphics.translate(0, 40f);
    super.render(camera, gameContainer);
    graphics.popTransform();

    if (BattleToads.ALLOW_DEBUGGING) graphics.setColor(Color.magenta);
    if (BattleToads.ALLOW_DEBUGGING) graphics.draw(getCollisionHitbox(position));
  }
Exemplo n.º 2
0
  /**
   * Implementation of the core rendering function that just renders the map to the assigned graphic
   * context.
   *
   * @param g the graphics context used for the render operation
   */
  private void renderImpl(final Graphics g) {
    final Camera camera = Camera.getInstance();

    g.pushTransform();

    g.translate(-camera.getViewportOffsetX(), -camera.getViewportOffsetY());
    Camera.getInstance().clearDirtyAreas(g);

    synchronized (display) {
      synchronized (GameMap.LIGHT_LOCK) {
        // draw all items
        for (int i = 0, displaySize = display.size(); i < displaySize; i++) {
          display.get(i).draw(g);
        }
      }
    }

    g.popTransform();
  }