From 4c1c805f243f011c9e8088d16242c8d9d2b781e5 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 9 Jul 2018 17:32:35 +0200 Subject: [PATCH] Add addPattern Functionality to Engine --- lib/app_component.dart | 1 + lib/src/Engine.dart | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/app_component.dart b/lib/app_component.dart index 0539769..458b080 100644 --- a/lib/app_component.dart +++ b/lib/app_component.dart @@ -49,6 +49,7 @@ class AppComponent implements OnInit { void onRandomClicked() { engine.running = false; + engine.addPattern(); } void onEdgesClicked() { diff --git a/lib/src/Engine.dart b/lib/src/Engine.dart index d55f552..3a8263a 100644 --- a/lib/src/Engine.dart +++ b/lib/src/Engine.dart @@ -72,6 +72,17 @@ class Engine { _grid.render(canvas, interp); } + void addPattern( + {CellPattern pattern, int x, int y, int amount, int dispersal, int seed}) { + _grid.addPattern( + pattern: pattern, + x: x, + y: y, + amount: amount, + dispersal: dispersal, + seed: seed); + } + void toggleEdgeRendering() { _grid.renderEdges = !_grid.renderEdges; }