Esempio n. 1
0
  public void zoomIn() {
    int width = grid.getWidth();
    int height = grid.getHeight();
    grid.cropLeft(width / 4);
    grid.cropRight(width / 4);
    grid.cropTop(height / 4);
    grid.cropBottom(height / 4);
    cellSizeProperty.set(cellSizeProperty.get() * 2);

    timelineRate = timeline.getRate();
    init();
    runner.setGrid(grid);
  }
Esempio n. 2
0
  public void zoomOut() {
    int width = grid.getWidth();
    int height = grid.getHeight();
    grid.padLeft(width / 2);
    grid.padRight(width / 2);
    grid.padTop(height / 2);
    grid.padBottom(height / 2);
    cellSizeProperty.set(cellSizeProperty.get() / 2);

    timelineRate = timeline.getRate();
    init();
    runner.setGrid(grid);
  }
Esempio n. 3
0
  private void updateGrid() {
    runner.nextGeneration();
    if (totalCells > 0) {
      int cellsAdded = 0;
      cellsAdded += addLiveCellViews();
      if (cellsAdded < centralCellsToMake) cellsAdded += addCentralCellViews(cellsAdded);
      if (cellsAdded < outerCellsToMake) cellsAdded += addOuterCellViews(cellsAdded);

      //			System.out.print(totalCells);
      totalCells -= cellsAdded;
      //			System.out.println(" - " + cellsAdded + " = " + totalCells);
    }
  }
Esempio n. 4
0
 public void setRule(Rule rule) {
   runner.setRule(rule);
   ((Stage) getScene().getWindow()).setTitle("Game of Life - " + rule);
 }