Make grid Private to Engine

This commit is contained in:
Marty Oehme 2018-07-09 17:31:46 +02:00
parent dfcd55fe71
commit 6745f9c9d6

View file

@ -19,20 +19,20 @@ class Engine {
num _drawLag = 0.0; num _drawLag = 0.0;
final html.CanvasElement canvas; final html.CanvasElement canvas;
Grid grid = new Grid(100, 100); Grid _grid = new Grid(100, 100);
bool _running = false; bool _running = false;
Engine(this.canvas) { Engine(this.canvas) {
_elapsed.start(); _elapsed.start();
grid.addPattern(amount: 15, dispersal: 5); _grid.addPattern(amount: 15, dispersal: 5);
} }
void reset() { void reset() {
grid.reset(); _grid.reset();
} }
void clear() { void clear() {
grid = new Grid(100, 100); _grid = new Grid(100, 100);
running = false; running = false;
} }
@ -59,7 +59,8 @@ class Engine {
void update() { void update() {
// print("updating"); // print("updating");
if(!grid.update()) running = false; if (!_grid.update()) running = false;
}
void step() { void step() {
running = false; running = false;
@ -68,7 +69,9 @@ class Engine {
void render([num interp]) { void render([num interp]) {
// print("rendering"); // print("rendering");
grid.render(canvas, interp); _grid.render(canvas, interp);
}
void toggleEdgeRendering() { void toggleEdgeRendering() {
_grid.renderEdges = !_grid.renderEdges; _grid.renderEdges = !_grid.renderEdges;
} }