cellular-automata/lib/service/configuration_service.dart

29 lines
670 B
Dart
Raw Normal View History

import 'package:rules_of_living/service/engine_service.dart';
class ConfigurationService {
final EngineService engineService;
bool showGrid;
int _simSpeed;
2018-08-25 14:41:11 +00:00
/// Simulation Speed
///
/// Sets the number of updates the simulation takes per second. Can range from
/// 1 to arbitrarily high numbers (though setting it too high can potentially
/// make the app brittle).
int get simSpeed => _simSpeed;
void set simSpeed(int val) {
_simSpeed = val;
engineService.engine.stepsPerSecond = simSpeed;
}
ConfigurationService(this.engineService) {
showGrid = false;
simSpeed = 5;
}
void toggleGrid() {
showGrid = !showGrid;
}
}