dartfmt
This commit is contained in:
parent
223f831196
commit
6ba0ca55cb
6 changed files with 43 additions and 15 deletions
|
@ -8,7 +8,15 @@ import 'package:rules_of_living/service/engine_service.dart';
|
|||
@Component(
|
||||
selector: 'my-app',
|
||||
templateUrl: "app_component.html",
|
||||
directives: [coreDirectives, MaterialButtonComponent, MaterialIconComponent, MaterialSliderComponent, HeaderComponent, SimulationComponent, ControlsComponent],
|
||||
directives: [
|
||||
coreDirectives,
|
||||
MaterialButtonComponent,
|
||||
MaterialIconComponent,
|
||||
MaterialSliderComponent,
|
||||
HeaderComponent,
|
||||
SimulationComponent,
|
||||
ControlsComponent
|
||||
],
|
||||
providers: [materialProviders, ClassProvider(EngineService)],
|
||||
styleUrls: const ['package:angular_components/app_layout/layout.scss.css'],
|
||||
)
|
||||
|
|
|
@ -6,7 +6,13 @@ import 'package:rules_of_living/src/Engine.dart';
|
|||
@Component(
|
||||
selector: 'sim-controls',
|
||||
templateUrl: "controls_component.html",
|
||||
directives: [coreDirectives, MaterialButtonComponent, MaterialIconComponent, MaterialSliderComponent, MaterialTooltipDirective],
|
||||
directives: [
|
||||
coreDirectives,
|
||||
MaterialButtonComponent,
|
||||
MaterialIconComponent,
|
||||
MaterialSliderComponent,
|
||||
MaterialTooltipDirective
|
||||
],
|
||||
providers: [],
|
||||
styleUrls: const ["controls_component.css"],
|
||||
)
|
||||
|
|
|
@ -4,10 +4,13 @@ import 'package:angular_components/angular_components.dart';
|
|||
@Component(
|
||||
selector: 'app_header',
|
||||
templateUrl: "header_component.html",
|
||||
directives: [coreDirectives, MaterialButtonComponent, MaterialIconComponent, MaterialSliderComponent],
|
||||
directives: [
|
||||
coreDirectives,
|
||||
MaterialButtonComponent,
|
||||
MaterialIconComponent,
|
||||
MaterialSliderComponent
|
||||
],
|
||||
providers: [],
|
||||
styleUrls: const ['package:angular_components/app_layout/layout.scss.css'],
|
||||
)
|
||||
class HeaderComponent {
|
||||
|
||||
}
|
||||
class HeaderComponent {}
|
||||
|
|
|
@ -20,7 +20,7 @@ class SimulationComponent implements OnInit {
|
|||
html.CanvasElement canvas = html.CanvasElement()..id = "simulation";
|
||||
html.querySelector("#simulation")..append(canvas);
|
||||
canvas.width = 500;
|
||||
canvas.height= 500;
|
||||
canvas.height = 500;
|
||||
|
||||
canvas.context2D.setFillColorRgb(200, 0, 0);
|
||||
canvas.context2D.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
@ -28,7 +28,7 @@ class SimulationComponent implements OnInit {
|
|||
canvas.context2D.fillText('''
|
||||
If you see this\n
|
||||
the app is broken :(
|
||||
''', canvas.width/2-50, canvas.height/2);
|
||||
''', canvas.width / 2 - 50, canvas.height / 2);
|
||||
engineService.create(canvas);
|
||||
|
||||
html.window.animationFrame.then(animFrame);
|
||||
|
|
|
@ -74,7 +74,12 @@ class Engine {
|
|||
}
|
||||
|
||||
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(
|
||||
pattern: pattern,
|
||||
x: x,
|
||||
|
|
|
@ -44,7 +44,12 @@ class Grid {
|
|||
}
|
||||
|
||||
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;
|
||||
math.Random rng = new math.Random(_startingSeed);
|
||||
_x = x;
|
||||
|
@ -154,7 +159,7 @@ class Grid {
|
|||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
Cell c = map[y][x];
|
||||
if(c.state != c.nextState) stateChanges = true;
|
||||
if (c.state != c.nextState) stateChanges = true;
|
||||
c.advanceState();
|
||||
|
||||
if (!_dirty && map[y][x].dirty) _dirty = true;
|
||||
|
@ -212,5 +217,6 @@ class Grid {
|
|||
_renderEdges = on;
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
bool get renderEdges => _renderEdges;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue