Initial commit.
This commit is contained in:
commit
44b5f2392f
98 changed files with 11750 additions and 0 deletions
34
simulation.h
Normal file
34
simulation.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
#ifndef MBOSTOCK_SIMULATION_H
|
||||
#define MBOSTOCK_SIMULATION_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace mbostock {
|
||||
|
||||
class Simulation {
|
||||
public:
|
||||
Simulation(uint32_t timeStepMs);
|
||||
virtual ~Simulation() {}
|
||||
|
||||
virtual void togglePaused();
|
||||
inline bool paused() const { return paused_; }
|
||||
|
||||
void simulate();
|
||||
|
||||
protected:
|
||||
virtual void step() = 0;
|
||||
|
||||
private:
|
||||
uint32_t elapsedMillis();
|
||||
|
||||
uint32_t timeStepMs_;
|
||||
uint32_t skippedMs_;
|
||||
uint32_t lastTimeMs_;
|
||||
bool paused_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue