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