all of the changes
This commit is contained in:
15
include/FluidSim/Desktop/PedalControl.hpp
Normal file
15
include/FluidSim/Desktop/PedalControl.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
namespace fluidsim::port::desktop {
|
||||
// Keyboard input travel is separate from the ECU actuator response.
|
||||
class PedalControl {
|
||||
public:
|
||||
float value() const {return value_;}
|
||||
void set(float value) {value_=std::clamp(value,0.f,1.f);}
|
||||
void advance(float dt,bool raise,bool lower) {
|
||||
if(dt>0) set(value_+(raise && !lower?2.f:-2.f)*dt);
|
||||
}
|
||||
private:
|
||||
float value_{};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user