Unknown
6b4786fdd0
Will eventually attach to the Simulation directly without first going through Engine. For now just redirects calls to EngineService to keep functions intact.
43 lines
901 B
Dart
43 lines
901 B
Dart
import 'package:angular/angular.dart';
|
|
import 'package:angular_components/angular_components.dart';
|
|
import 'package:rules_of_living/service/engine_service.dart';
|
|
import 'package:rules_of_living/service/simulation_service.dart';
|
|
|
|
@Component(
|
|
selector: 'sim-controls',
|
|
templateUrl: "controls_component.html",
|
|
directives: [
|
|
coreDirectives,
|
|
MaterialButtonComponent,
|
|
MaterialIconComponent,
|
|
MaterialTooltipDirective
|
|
],
|
|
providers: [],
|
|
styleUrls: const ["controls_component.css"],
|
|
)
|
|
class ControlsComponent {
|
|
final EngineService engine;
|
|
final SimulationService sim;
|
|
|
|
ControlsComponent(this.engine, this.sim);
|
|
|
|
void onStartClicked() {
|
|
engine.toggleRunning();
|
|
}
|
|
|
|
void onStepClicked() {
|
|
engine.step();
|
|
}
|
|
|
|
void onResetClicked() {
|
|
sim.reset();
|
|
}
|
|
|
|
void onRandomClicked() {
|
|
sim.addRandomPattern();
|
|
}
|
|
|
|
void onClearClicked() {
|
|
sim.clear();
|
|
}
|
|
}
|