Error out on bad gridsize input

This commit is contained in:
Marty Oehme 2018-08-27 20:18:19 +02:00
parent 873bd9c881
commit 04d61bfa02
2 changed files with 14 additions and 2 deletions

View file

@ -32,7 +32,12 @@ class Engine {
/// Grid Size
///
/// Number of cells on x coordinate and y coordinate. Can be set individually.
Point gridSize = Point<int>(100, 100);
Point get gridSize => Point<int>(_grid.w, _grid.h);
void set gridSize(Point<int> value) {
if (value.x <= 0 || value.y <= 0)
throw ArgumentError("grid size must not be smaller than 1");
_grid = Grid(value.x, value.y);
}
num _updateLag = 0.0;
num _drawLag = 0.0;