X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=antikythera;a=blobdiff_plain;f=src%2Fmachine.h;fp=src%2Fmachine.h;h=f222cd78ec6a2e274dd38b636169d393c289722a;hp=0000000000000000000000000000000000000000;hb=a88a9ac53952e1bb3768b147a043c19392e3d5d1;hpb=ae60a8cb1a30e204e7f60969fe6245e510cca0ff diff --git a/src/machine.h b/src/machine.h new file mode 100644 index 0000000..f222cd7 --- /dev/null +++ b/src/machine.h @@ -0,0 +1,35 @@ +#ifndef MACHINE_H_ +#define MACHINE_H_ + +#include +#include "gear.h" + +struct Motor { + float speed; /* signed to denote direction, in Hz */ + int drive; /* which gear it drives */ +}; + +class Machine { +private: + std::vector gears; + bool **meshing; + bool *visited; /* used for update_gear */ + + std::vector motors; + + void update_gear(int idx, float angle); + +public: + Machine(); + ~Machine(); + + void add_gear(Gear *g); /* takes ownership */ + void add_motor(int gearidx, float speed_hz); + + void calc_meshing(); + + void update(float dt); + void draw() const; +}; + +#endif // MACHINE_H_