Beispiel #1
0
  @Override
  public void draw(Graphics2D g) {
    String string =
        WorldMapRenderer.pixelsToTiles(map.getCenterX())
            + " | "
            + WorldMapRenderer.pixelsToTiles(map.getCenterY())
            + "\n"
            + renderer.getRenderCenterX()
            + "|"
            + renderer.getRenderCenterY();

    renderer.draw(g, map, wm.getWidth(), wm.getHeight());
    g.drawString(string, 0, FONT_SIZE);
  }
Beispiel #2
0
 public void init() {
   super.init();
   initInput();
   // create and start a new Resource Manager.  The resource Manager is responsible for loading
   // game elements.
   ResourceManager rM = new ResourceManager(wm.getFullScreenWindow().getGraphicsConfiguration());
   world = generateGameWorld(SIZE_H, SIZE_W);
   // load our resources!
   renderer = new WorldMapRenderer();
   map = new WorldMap(world, SIZE_H, SIZE_W);
   // initialize the renderer at the center of the map(Or of course, whereever the hell we want to
   // really)
   renderer.setRenderCenterX(wm.getWidth() / 2 - map.getCenterX());
   renderer.setRenderCenterY(wm.getHeight() / 2 - map.getCenterY());
 }