Allow Optional Injection of grid size into engine on creation

This commit is contained in:
Marty Oehme 2018-08-27 20:13:19 +02:00
parent 9886f13d69
commit 873bd9c881
3 changed files with 24 additions and 21 deletions

View file

@ -46,8 +46,8 @@ class Engine {
Grid _grid;
bool running = false;
Engine([this.canvas]) {
_grid = Grid(gridSize.x, gridSize.y);
Engine([x = 100, y = 100, this.canvas]) {
_grid = Grid(x, y);
_elapsed.start();
_grid.addPattern(amount: 15, dispersal: 5);
@ -115,7 +115,7 @@ class Engine {
/// the internal engine processing. Does not do anything if no canvas is
/// defined.
void render([num interp]) {
if(canvas != null) _grid.render(canvas, interp);
if (canvas != null) _grid.render(canvas, interp);
}
void addPattern(