Fix Input::AxisValueChanged event to properly handle value changes when using keyboard
#2393
This commit is contained in:
@@ -27,32 +27,18 @@ struct AxisEvaluation
|
|||||||
|
|
||||||
struct ActionData
|
struct ActionData
|
||||||
{
|
{
|
||||||
bool Active;
|
bool Active = false;
|
||||||
uint64 FrameIndex;
|
uint64 FrameIndex = 0;
|
||||||
InputActionState State;
|
InputActionState State = InputActionState::Waiting;
|
||||||
|
|
||||||
ActionData()
|
|
||||||
{
|
|
||||||
Active = false;
|
|
||||||
FrameIndex = 0;
|
|
||||||
State = InputActionState::Waiting;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AxisData
|
struct AxisData
|
||||||
{
|
{
|
||||||
float Value;
|
float Value = 0.0f;
|
||||||
float ValueRaw;
|
float ValueRaw = 0.0f;
|
||||||
float PrevKeyValue;
|
float PrevValue = 0.0f;
|
||||||
uint64 FrameIndex;
|
float PrevKeyValue = 0.0f;
|
||||||
|
uint64 FrameIndex = 0;
|
||||||
AxisData()
|
|
||||||
{
|
|
||||||
Value = 0.0f;
|
|
||||||
ValueRaw = 0.0f;
|
|
||||||
PrevKeyValue = 0.0f;
|
|
||||||
FrameIndex = 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace InputImpl
|
namespace InputImpl
|
||||||
@@ -990,6 +976,7 @@ void InputService::Update()
|
|||||||
|
|
||||||
// Setup axis data
|
// Setup axis data
|
||||||
data.PrevKeyValue = e.PrevKeyValue;
|
data.PrevKeyValue = e.PrevKeyValue;
|
||||||
|
data.PrevValue = data.Value;
|
||||||
data.ValueRaw = e.RawValue;
|
data.ValueRaw = e.RawValue;
|
||||||
data.Value = e.Value;
|
data.Value = e.Value;
|
||||||
|
|
||||||
@@ -1025,7 +1012,7 @@ void InputService::Update()
|
|||||||
{
|
{
|
||||||
for (auto i = Axes.Begin(); i.IsNotEnd(); ++i)
|
for (auto i = Axes.Begin(); i.IsNotEnd(); ++i)
|
||||||
{
|
{
|
||||||
if (Math::NotNearEqual(i->Value.Value, i->Value.PrevKeyValue))
|
if (Math::NotNearEqual(i->Value.Value, i->Value.PrevValue))
|
||||||
{
|
{
|
||||||
Input::AxisValueChanged(i->Key);
|
Input::AxisValueChanged(i->Key);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user