public void render(int xScroll, int yScroll, Screen screen) {
    if (xScroll < 0) {
      xScroll = 0;
    }
    if (xScroll > ((width << 4) - screen.width)) {
      xScroll = ((width << 4) - screen.width);
    }
    if (yScroll < 0) {
      yScroll = 0;
    }
    if (yScroll > ((height << 4) - screen.height)) {
      yScroll = ((height << 4) - screen.height);
    }

    screen.setOffset(xScroll, yScroll);
    int xMin = xScroll >> 4;
    int xMax = (xScroll + screen.width) >> 4;
    int yMin = yScroll >> 4;
    int yMax = (yScroll + screen.height) >> 4;

    for (int y = yMin; y < yMax + 15; y++) {
      for (int x = xMin; x < xMax + 15; x++) {
        Tile tile = getTile(x, y);
        tile.render(screen);
      }
    }
    synchronized (this.entities) {
      for (Iterator<Entity> it = this.entities.iterator(); it.hasNext();) {
        Entity e = (Entity) it.next();
        e.render(screen);
      }
    }
  }