Fixed and Enhanced Input Binding Management #298
|
@ -358,7 +358,7 @@ namespace SHADE
|
|||
|
||||
//How far the user needs to move an analog stick before application
|
||||
//registers the movement
|
||||
double dead = 0.1;
|
||||
double dead = 0.2;
|
||||
|
||||
//Speed in units per second that the axis will move toward target value for digital
|
||||
//For mouse movement / scrolling, serves as multiplier
|
||||
|
@ -691,10 +691,32 @@ namespace SHADE
|
|||
return bindings;
|
||||
}
|
||||
|
||||
//Add a new binding to the map
|
||||
static inline void AddBinding(std::string const& newBindingName) noexcept
|
||||
//Add a new binding to the map with settings
|
||||
//Binding type is between four different types,
|
||||
//KB_MB_CONTROLLER Binding is connected to the keyboard, mouse and controller buttons and its analog inputs
|
||||
//MOUSE_X Binding is connected to horizontal movement of the mouse
|
||||
//MOUSE_Y Binding is connected to the vertical movement of the mouse
|
||||
//MOUSE_SCROLL Binding is connected to the scrolling of the mouse wheel
|
||||
//Inverted is whether positive inputs result in a negative value and vice-versa
|
||||
//Snap is if inputting in the opposite direction results in the value snapping to 0 before continuing in the direction
|
||||
//Sensitivity is how fast the value moves with input
|
||||
//Dead is how much analogue input magnitude on a scale of 0 to 1 is required before being registered
|
||||
//Gravity is how fast the value moves to neutral without input
|
||||
static inline void AddBinding(std::string const& newBindingName,
|
||||
SH_BINDINGTYPE const bindingType = SH_BINDINGTYPE::KB_MB_CONTROLLER,
|
||||
bool const inverted = false,
|
||||
bool const snap = false,
|
||||
double const sensitivity = 1.0,
|
||||
double const dead = 0.2,
|
||||
double const gravity = 1.0) noexcept
|
||||
{
|
||||
bindings.insert({ newBindingName, SHLogicalBindingData() });
|
||||
bindings[newBindingName].bindingType = bindingType;
|
||||
bindings[newBindingName].inverted = inverted;
|
||||
bindings[newBindingName].snap = snap;
|
||||
bindings[newBindingName].sensitivity = sensitivity;
|
||||
bindings[newBindingName].dead = dead;
|
||||
bindings[newBindingName].gravity = gravity;
|
||||
}
|
||||
|
||||
//Remove a binding and all its associated inputs from the list
|
||||
|
@ -741,6 +763,7 @@ namespace SHADE
|
|||
//Gets the gravity of the binding
|
||||
//The rate at which the value moves to neutral if no input in the direction is read
|
||||
//Should be non-negative
|
||||
//Irrelevant for mouse movement and scrolling
|
||||
static inline double GetBindingGravity(std::string const& bindingName)
|
||||
{
|
||||
return bindings[bindingName].gravity;
|
||||
|
@ -749,6 +772,7 @@ namespace SHADE
|
|||
//Sets the gravity of the binding
|
||||
//The rate at which the value moves to neutral if no input in the direction is read
|
||||
//Should be non-negative
|
||||
//Irrelevant for mouse movement and scrolling
|
||||
static inline void SetBindingGravity(std::string const& bindingName, double const newValue)
|
||||
{
|
||||
bindings[bindingName].gravity = newValue;
|
||||
|
@ -756,7 +780,7 @@ namespace SHADE
|
|||
|
||||
//Get the dead zone of the binding on a scale of 0 to 1,
|
||||
//Any positive or negative analog input with magnitude less than this will be registered as neutral
|
||||
//irrelvant for digital inputs
|
||||
//Irrelvant for digital inputs, mouse movement and scrolling
|
||||
static inline double GetBindingDead(std::string const& bindingName)
|
||||
{
|
||||
return bindings[bindingName].dead;
|
||||
|
@ -764,7 +788,7 @@ namespace SHADE
|
|||
|
||||
//Get the dead zone of the binding on a scale of 0 to 1,
|
||||
//Any positive or negative analog input with magnitude less than this will be registered as neutral
|
||||
//irrelvant for digital inputs
|
||||
//Irrelvant for digital inputs, mouse movement and scrolling
|
||||
static inline void SetBindingDead(std::string const& bindingName, double const newValue)
|
||||
{
|
||||
bindings[bindingName].dead = newValue;
|
||||
|
@ -773,7 +797,7 @@ namespace SHADE
|
|||
//Get the sensitivity of the binding
|
||||
//Serves as a multiplier for mouse movement/scrolling
|
||||
//For other digital inputs, serves as a rate of how fast axis value goes to maximum positive/negative
|
||||
//For other analog inputs, serves as a multiplier
|
||||
//For other analog inputs, serves as a multiplier, but axis value magnitude will still be capped at 1
|
||||
static inline double GetBindingSensitivity(std::string const& bindingName)
|
||||
{
|
||||
return bindings[bindingName].sensitivity;
|
||||
|
@ -782,7 +806,7 @@ namespace SHADE
|
|||
//Set the sensitivity of the binding
|
||||
//Serves as a multiplier for mouse movement/scrolling
|
||||
//For other digital inputs, serves as a rate of how fast axis value goes to maximum positive/negative
|
||||
//For other analog inputs, serves as a multiplier
|
||||
//For other analog inputs, serves as a multiplier, but axis value magnitude will still be capped at 1
|
||||
static inline void SetBindingSensitivity(std::string const& bindingName, double const newValue)
|
||||
{
|
||||
bindings[bindingName].sensitivity = newValue;
|
||||
|
@ -791,6 +815,7 @@ namespace SHADE
|
|||
//Gets the snap of the binding
|
||||
//If no other input on the axis is present and a input is made in the opposite direction of the current value,
|
||||
//the binding's value will jump to neutral 0 before resuming in the input direction
|
||||
//Irrelevant for mouse movement and scrolling
|
||||
static inline bool GetBindingSnap(std::string const& bindingName)
|
||||
{
|
||||
return bindings[bindingName].snap;
|
||||
|
@ -799,6 +824,7 @@ namespace SHADE
|
|||
//Sets the snap of the binding
|
||||
//If no other input on the axis is present and a input is made in the opposite direction of the current value,
|
||||
//the binding's value will jump to neutral 0 before resuming in the input direction
|
||||
//Irrelevant for mouse movement and scrolling
|
||||
static inline void SetBindingSnap(std::string const& bindingName, bool const newValue)
|
||||
{
|
||||
bindings[bindingName].snap = newValue;
|
||||
|
|
Loading…
Reference in New Issue