Esempio n. 1
0
  private void renderSprites(Graphics2D g) {
    if (m_active == null) {
      return;
    }
    Point pos = new Point();
    int ox = m_visible.x;
    int oy = m_visible.y;

    for (Sprite item : m_active) {
      pos.setLocation(item.getX() - ox, item.getY() - oy);
      item.render(g, pos, m_tick);
    }
  }
Esempio n. 2
0
  private void renderMap(final Graphics2D g) {
    if (m_map == null) {
      return;
    }

    // get all the Tiles we need to render
    int minX = m_visible.x - Sprite.TILE_WIDTH;
    int maxX = m_visible.x + m_visible.width;
    Collection<Tile> tiles = m_map.getRange(minX, maxX);

    int ox = m_visible.x;
    int oy = m_visible.y;

    Point pos = new Point();

    for (Sprite item : tiles) {
      pos.setLocation(item.getX() - ox, item.getY() - oy);
      item.render(g, pos, m_tick);
    }
  }