diff --git a/openVulkanoCpp/Input/InputAction.hpp b/openVulkanoCpp/Input/InputAction.hpp index 7e97e35..b4b1ab9 100644 --- a/openVulkanoCpp/Input/InputAction.hpp +++ b/openVulkanoCpp/Input/InputAction.hpp @@ -53,11 +53,27 @@ namespace OpenVulkano::Input void BindKey(InputKey key, float scale = 1) { + for (auto& binding : keys) + { + if (binding.key == key) + { + binding.scale = scale; + return; + } + } keys.emplace_back(key, scale); } void BindAxisButtons(InputKey keyPositive, InputKey keyNegative, float scale = 1) { + for (auto& binding : axisButtons) + { + if (binding.positive == keyPositive && binding.negative == keyNegative) + { + binding.scale = scale; + return; + } + } axisButtons.emplace_back(keyPositive, keyNegative, scale); } }; diff --git a/openVulkanoCpp/Input/InputKey.hpp b/openVulkanoCpp/Input/InputKey.hpp index 90743da..d74df4c 100644 --- a/openVulkanoCpp/Input/InputKey.hpp +++ b/openVulkanoCpp/Input/InputKey.hpp @@ -309,5 +309,15 @@ namespace OpenVulkano::Input [[nodiscard]] InputType GetInputType() const { return type; } [[nodiscard]] int16_t GetInputKey() const { return key; } + + bool operator==(const InputKey& other) + { + return deviceType == other.deviceType && type == other.type && key == other.key; + } + + bool operator!=(const InputKey& other) + { + return !(*this == other); + } }; }