Add scaling factors for input actions
This commit is contained in:
@@ -36,13 +36,15 @@ namespace OpenVulkano::Input
|
||||
const std::vector<InputDevice*>& testDevices = action->GetDevices().empty() ? devices : action->GetDevices();
|
||||
for (const InputDevice* device : testDevices)
|
||||
{
|
||||
for(InputKey key : action->GetKeys())
|
||||
for(KeyBinding binding : action->GetKeys())
|
||||
{
|
||||
value += device->GetAxis(key);
|
||||
if (binding.key.GetInputDeviceType() != device->GetType()) continue;
|
||||
value += device->GetAxis(binding.key) * binding.scale;
|
||||
}
|
||||
for(const auto& keys : action->GetAxisButtons())
|
||||
for(const auto& binding : action->GetAxisButtons())
|
||||
{
|
||||
value += GetAxis(keys.first) - GetAxis(keys.second);
|
||||
if (binding.positive.GetInputDeviceType() != device->GetType()) continue;
|
||||
value += (GetAxis(binding.positive) - GetAxis(binding.negative)) * binding.scale;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
@@ -53,6 +55,7 @@ namespace OpenVulkano::Input
|
||||
float value = 0;
|
||||
for (const InputDevice* device : devices)
|
||||
{
|
||||
if (key.GetInputDeviceType() != device->GetType()) continue;
|
||||
value += device->GetAxis(key);
|
||||
}
|
||||
return value;
|
||||
@@ -63,9 +66,10 @@ namespace OpenVulkano::Input
|
||||
const std::vector<InputDevice*>& testDevices = action->GetDevices().empty() ? devices : action->GetDevices();
|
||||
for (const InputDevice* device : testDevices)
|
||||
{
|
||||
for (const InputKey key : action->GetKeys())
|
||||
for (const KeyBinding binding : action->GetKeys())
|
||||
{
|
||||
if (device->GetButton(key)) return true;
|
||||
if (binding.key.GetInputDeviceType() != device->GetType()) continue;
|
||||
if (device->GetButton(binding.key)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -75,6 +79,7 @@ namespace OpenVulkano::Input
|
||||
{
|
||||
for(const InputDevice* device : devices)
|
||||
{
|
||||
if (key.GetInputDeviceType() != device->GetType()) continue;
|
||||
if (device->GetButton(key)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user