From 6745f9c9d6cdf34d2973d83f2c6a3e8110b0e4c8 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 9 Jul 2018 17:31:46 +0200 Subject: [PATCH] Make grid Private to Engine --- lib/src/Engine.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/src/Engine.dart b/lib/src/Engine.dart index a737758..d55f552 100644 --- a/lib/src/Engine.dart +++ b/lib/src/Engine.dart @@ -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; }