Separate Engine Service Functionality from Component

This commit is contained in:
Marty Oehme 2018-08-25 09:33:15 +02:00
parent 842cbeca1f
commit 976ec8097d
4 changed files with 47 additions and 23 deletions

View file

@ -24,11 +24,17 @@ class Engine {
final html.CanvasElement canvas;
Grid _grid = new Grid(GRID_X, GRID_Y);
bool _running = false;
bool running = false;
Engine([this.canvas]) {
_elapsed.start();
_grid.addPattern(amount: 15, dispersal: 5);
html.window.animationFrame.then(animFrame);
}
void animFrame(num now) {
process(now);
html.window.animationFrame.then(animFrame);
}
void reset() {
@ -95,7 +101,4 @@ class Engine {
void toggleEdgeRendering() {
_grid.renderEdges = !_grid.renderEdges;
}
void set running(bool on) => _running = on;
bool get running => _running;
}