cellular-automata/lib/service/control_service.dart

38 lines
593 B
Dart

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;
}