diff --git a/lib/app_component.dart b/lib/app_component.dart index ae8a931..2d4557f 100644 --- a/lib/app_component.dart +++ b/lib/app_component.dart @@ -5,7 +5,6 @@ import 'package:rules_of_living/components/controls_component.dart'; import 'package:rules_of_living/components/header_component.dart'; import 'package:rules_of_living/components/simulation_component.dart'; import 'package:rules_of_living/service/configuration_service.dart'; -import 'package:rules_of_living/service/control_service.dart'; import 'package:rules_of_living/service/engine_service.dart'; @Component( @@ -25,7 +24,6 @@ import 'package:rules_of_living/service/engine_service.dart'; materialProviders, ClassProvider(EngineService), ClassProvider(ConfigurationService), - ClassProvider(ControlService) ], styleUrls: const [ 'package:angular_components/app_layout/layout.scss.css', diff --git a/lib/components/controls_component.dart b/lib/components/controls_component.dart index 954d94b..f4b5264 100644 --- a/lib/components/controls_component.dart +++ b/lib/components/controls_component.dart @@ -1,6 +1,6 @@ import 'package:angular/angular.dart'; import 'package:angular_components/angular_components.dart'; -import 'package:rules_of_living/service/control_service.dart'; +import 'package:rules_of_living/service/engine_service.dart'; @Component( selector: 'sim-controls', @@ -15,7 +15,7 @@ import 'package:rules_of_living/service/control_service.dart'; styleUrls: const ["controls_component.css"], ) class ControlsComponent { - final ControlService ctrl; + final EngineService ctrl; ControlsComponent(this.ctrl); diff --git a/lib/service/control_service.dart b/lib/service/control_service.dart deleted file mode 100644 index 0066106..0000000 --- a/lib/service/control_service.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:rules_of_living/service/engine_service.dart'; - -class ControlService { - EngineService _es; - - ControlService(this._es); - - void run() { - _es.engine.running = true; - } - - void stop() { - _es.engine.running = false; - } - - void toggleRunning() { - _es.engine.running = !_es.engine.running; - } - - void step() { - _es.engine.step(); - } - - void reset() { - _es.engine.reset(); - } - - void addRandomPattern() { - _es.engine.running = false; - _es.engine.addPattern(); - } - - void clear() { - _es.engine.clear(); - } - - bool get isRunning => _es.engine.running; -} diff --git a/lib/service/engine_service.dart b/lib/service/engine_service.dart index 8168735..df1492c 100644 --- a/lib/service/engine_service.dart +++ b/lib/service/engine_service.dart @@ -12,4 +12,35 @@ class EngineService { engine = newEngine; return newEngine; } + + void run() { + engine.running = true; + } + + void stop() { + engine.running = false; + } + + void toggleRunning() { + engine.running = !engine.running; + } + + void step() { + engine.step(); + } + + void reset() { + engine.reset(); + } + + void addRandomPattern() { + engine.running = false; + engine.addPattern(); + } + + void clear() { + engine.clear(); + } + + bool get isRunning => engine.running; }