20 lines
516 B
C++
20 lines
516 B
C++
// src/timing/speed_controller.h
|
||
#pragma once
|
||
#include "mbed.h"
|
||
|
||
class SpeedController {
|
||
private:
|
||
int ground_speed = 1;
|
||
|
||
public:
|
||
SpeedController() = default;
|
||
|
||
void set_ground_speed(int spd);
|
||
int get_ground_speed() const { return ground_speed; }
|
||
|
||
// Calculates how many frames to advance for current tick.
|
||
// Takes object’s current speed and a global tick counter
|
||
// to automatically handle slower "wait" behavior.
|
||
int frame_advance_for(int object_speed, int tick_counter) const;
|
||
};
|