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); }
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); }
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); } }
public void setRule(Rule rule) { runner.setRule(rule); ((Stage) getScene().getWindow()).setTitle("Game of Life - " + rule); }