This commit is contained in:
Marty Oehme 2018-08-23 12:38:34 +02:00
parent 223f831196
commit 6ba0ca55cb
6 changed files with 43 additions and 15 deletions

View file

@ -8,7 +8,15 @@ import 'package:rules_of_living/service/engine_service.dart';
@Component( @Component(
selector: 'my-app', selector: 'my-app',
templateUrl: "app_component.html", templateUrl: "app_component.html",
directives: [coreDirectives, MaterialButtonComponent, MaterialIconComponent, MaterialSliderComponent, HeaderComponent, SimulationComponent, ControlsComponent], directives: [
coreDirectives,
MaterialButtonComponent,
MaterialIconComponent,
MaterialSliderComponent,
HeaderComponent,
SimulationComponent,
ControlsComponent
],
providers: [materialProviders, ClassProvider(EngineService)], providers: [materialProviders, ClassProvider(EngineService)],
styleUrls: const ['package:angular_components/app_layout/layout.scss.css'], styleUrls: const ['package:angular_components/app_layout/layout.scss.css'],
) )

View file

@ -6,7 +6,13 @@ import 'package:rules_of_living/src/Engine.dart';
@Component( @Component(
selector: 'sim-controls', selector: 'sim-controls',
templateUrl: "controls_component.html", templateUrl: "controls_component.html",
directives: [coreDirectives, MaterialButtonComponent, MaterialIconComponent, MaterialSliderComponent, MaterialTooltipDirective], directives: [
coreDirectives,
MaterialButtonComponent,
MaterialIconComponent,
MaterialSliderComponent,
MaterialTooltipDirective
],
providers: [], providers: [],
styleUrls: const ["controls_component.css"], styleUrls: const ["controls_component.css"],
) )

View file

@ -4,10 +4,13 @@ import 'package:angular_components/angular_components.dart';
@Component( @Component(
selector: 'app_header', selector: 'app_header',
templateUrl: "header_component.html", templateUrl: "header_component.html",
directives: [coreDirectives, MaterialButtonComponent, MaterialIconComponent, MaterialSliderComponent], directives: [
coreDirectives,
MaterialButtonComponent,
MaterialIconComponent,
MaterialSliderComponent
],
providers: [], providers: [],
styleUrls: const ['package:angular_components/app_layout/layout.scss.css'], styleUrls: const ['package:angular_components/app_layout/layout.scss.css'],
) )
class HeaderComponent { class HeaderComponent {}
}

View file

@ -74,7 +74,12 @@ class Engine {
} }
void addPattern( void addPattern(
{CellPattern pattern, int x, int y, int amount, int dispersal, int seed}) { {CellPattern pattern,
int x,
int y,
int amount,
int dispersal,
int seed}) {
_grid.addPattern( _grid.addPattern(
pattern: pattern, pattern: pattern,
x: x, x: x,

View file

@ -44,7 +44,12 @@ class Grid {
} }
void addPattern( void addPattern(
{CellPattern pattern, int x, int y, int amount, int dispersal, int seed}) { {CellPattern pattern,
int x,
int y,
int amount,
int dispersal,
int seed}) {
_startingSeed = seed ?? DateTime.now().millisecondsSinceEpoch; _startingSeed = seed ?? DateTime.now().millisecondsSinceEpoch;
math.Random rng = new math.Random(_startingSeed); math.Random rng = new math.Random(_startingSeed);
_x = x; _x = x;
@ -212,5 +217,6 @@ class Grid {
_renderEdges = on; _renderEdges = on;
_dirty = true; _dirty = true;
} }
bool get renderEdges => _renderEdges; bool get renderEdges => _renderEdges;
} }