Add Simple Documentation

This commit is contained in:
Marty Oehme 2018-08-25 16:41:11 +02:00
parent c3f0881454
commit 774e9e3782
2 changed files with 18 additions and 1 deletions

View file

@ -6,6 +6,12 @@ class ConfigurationService {
bool showGrid; bool showGrid;
int _simSpeed; int _simSpeed;
/// 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; int get simSpeed => _simSpeed;
void set simSpeed(int val) { void set simSpeed(int val) {
_simSpeed = val; _simSpeed = val;

View file

@ -6,8 +6,19 @@ class Engine {
// Elapsed Time Counter - useful for Safety Timeout // Elapsed Time Counter - useful for Safety Timeout
Stopwatch _elapsed = new Stopwatch(); Stopwatch _elapsed = new Stopwatch();
// Game Tick Rate - *does* impact game speed TODO add configurable option /// Game Tick Rate
///
/// *does* impact game speed; dictates how long each logic step takes. Only
/// interesting for engine internal calculations, to set simulation speed
/// from the outside use stepsPerSecond instead.
int _MS_PER_STEP = 1000 ~/ 3; int _MS_PER_STEP = 1000 ~/ 3;
/// Set Logic Updates per Second
///
/// Dictates simulation speed. Sets the amount of (logic) updates per second.
/// Translations between number of updates and their timings is not exact so
/// comparing this variable to fixed ints might not yield the expected results.
/// Does not affect render frequency, which is handled by framesPerSecond.
int get stepsPerSecond => 1000 ~/ _MS_PER_STEP; int get stepsPerSecond => 1000 ~/ _MS_PER_STEP;
set stepsPerSecond(int val) => _MS_PER_STEP = 1000 ~/ val; set stepsPerSecond(int val) => _MS_PER_STEP = 1000 ~/ val;