#include <tb_input_action.hpp>
Provides an abstract interface for converting a signal from analog to digital, digital to analog, or playing with analog to analog for custom thresholds, deadzones ranges or interpolation methods. Just derive from the base and set in the InputAction::SetInputSignalConverter().
◆ InputSignalConverterInterface()
| TurtleBrains::Game::InputSignalConverterInterface::InputSignalConverterInterface |
( |
void |
| ) |
|
|
inline |
Constructs a SignalConverter abstract object, does nothing.
◆ ~InputSignalConverterInterface()
| virtual TurtleBrains::Game::InputSignalConverterInterface::~InputSignalConverterInterface |
( |
void |
| ) |
|
|
inlinevirtual |
Destroys the SignalConverter object, does nothing.
◆ AnalogToAnalogConverter()
| virtual float TurtleBrains::Game::InputSignalConverterInterface::AnalogToAnalogConverter |
( |
float |
analogValue, |
|
|
float |
deltaTime |
|
) |
| |
|
pure virtual |
Convert an analog; 0-1 signal into a analog; 0-1 signal. Typically this would be used to set deadzones, ranges or thresholds - and or change interpolation from linear to something different.
- Parameters
-
| analogValue | is a number from 0 to 1 representing the axis of a controller device. |
| deltaTime | is the amount of time that is passing during this frame or timestep which depends what stage the InputAction poll is running, Simulate (fixedTime) or Update (deltaTime). |
◆ AnalogToDigitalConverter()
| virtual bool TurtleBrains::Game::InputSignalConverterInterface::AnalogToDigitalConverter |
( |
float |
analogValue, |
|
|
float |
deltaTime |
|
) |
| |
|
pure virtual |
Convert a analog; 0-1 signal into a digital; on/off signal. Typically there would be some threshold value to turn the digital signal on/off.
- Parameters
-
| analogValue | is a number from 0 to 1 representing the axis of a controller device. |
| deltaTime | is the amount of time that is passing during this frame or timestep which depends what stage the InputAction poll is running, Simulate (fixedTime) or Update (deltaTime). |
◆ DigitalToAnalogConverter()
| virtual float TurtleBrains::Game::InputSignalConverterInterface::DigitalToAnalogConverter |
( |
bool |
digitalValue, |
|
|
float |
deltaTime |
|
) |
| |
|
pure virtual |
Convert a digital; on/off signal into an analog 0-1 signal.
- Parameters
-
| digitalValue | is true if the digital button is pressed/down, otherwise false. |
| deltaTime | is the amount of time that is passing during this frame or timestep which depends what stage the InputAction poll is running, Simulate (fixedTime) or Update (deltaTime). |
- Note
- This API may change in the future to include an addition float parameter for currentAnalog value since there could be a subtle bug/issue when using an InputAction that adjusts / holds a current value during each timestep. Much like a common/default press/release rate. Consider that the current value held in the child object is X, then Simulate::Poll is called (internally), now we have X+1, then Update::Poll is called and it will get to X+2 instead of X+1 there.
◆ InvertAnalogValue()
| virtual float TurtleBrains::Game::InputSignalConverterInterface::InvertAnalogValue |
( |
float |
analogValue | ) |
|
|
inlinevirtual |
Called when an axis / analog signal should be inverted. The default implementation does a simple ONE_MINUS_VALUE inversion. This will be called only if/when the axis is bound with inverted set to true.