Beispiel #1
0
  protected void toggleZoom(Graphics2D g) {
    _appState = Constants.appStates.Paused;

    int width = getGameOptions().get("fieldPixelWidth");
    int height = getGameOptions().get("fieldPixelHeight");

    if (width == initialOptions.fieldPixelWidth) {
      width = width * 2;
      height = height * 2;

    } else {
      width = width / 2;
      height = height / 2;
    }

    getGameOptions().put("fieldPixelWidth", width);
    getGameOptions().put("fieldPixelHeight", height);

    _canvas.setPreferredSize(
        new Dimension(
            getGameOptions().get("fieldPixelWidth"), getGameOptions().get("fieldPixelHeight")));
    _canvas.drawField(g);

    pack();
    repaint();

    _appState = Constants.appStates.Initialized;
  }