2018-08-23 12:12:22 +00:00
|
|
|
import 'package:rules_of_living/service/engine_service.dart';
|
|
|
|
|
|
|
|
class ConfigurationService {
|
|
|
|
final EngineService engineService;
|
|
|
|
|
|
|
|
bool showGrid;
|
2018-08-25 13:26:44 +00:00
|
|
|
|
|
|
|
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).
|
2018-08-25 13:26:44 +00:00
|
|
|
int get simSpeed => _simSpeed;
|
|
|
|
void set simSpeed(int val) {
|
2018-08-25 13:51:32 +00:00
|
|
|
_simSpeed = val;
|
|
|
|
engineService.engine.stepsPerSecond = simSpeed;
|
2018-08-25 13:26:44 +00:00
|
|
|
}
|
2018-08-23 12:12:22 +00:00
|
|
|
|
|
|
|
ConfigurationService(this.engineService) {
|
|
|
|
showGrid = false;
|
|
|
|
simSpeed = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
void toggleGrid() {
|
|
|
|
showGrid = !showGrid;
|
|
|
|
}
|
|
|
|
}
|