Add Canvas nullcheck to render function
This commit is contained in:
parent
572406b963
commit
4c6dff35c3
3 changed files with 19 additions and 9 deletions
|
|
@ -22,7 +22,7 @@ class Engine {
|
|||
num _updateLag = 0.0;
|
||||
num _drawLag = 0.0;
|
||||
|
||||
final html.CanvasElement canvas;
|
||||
html.CanvasElement canvas;
|
||||
Grid _grid = new Grid(GRID_X, GRID_Y);
|
||||
bool running = false;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ class Engine {
|
|||
}
|
||||
|
||||
void clear() {
|
||||
_grid = new Grid(100, 100);
|
||||
_grid = new Grid(GRID_X, GRID_Y);
|
||||
running = false;
|
||||
}
|
||||
|
||||
|
|
@ -78,8 +78,7 @@ class Engine {
|
|||
}
|
||||
|
||||
void render([num interp]) {
|
||||
// print("rendering");
|
||||
_grid.render(canvas, interp);
|
||||
if(canvas != null) _grid.render(canvas, interp);
|
||||
}
|
||||
|
||||
void addPattern(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue