summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-12-13 15:32:55 +0100
committerLioncash <mathew1800@gmail.com>2021-12-13 15:57:51 +0100
commite826e6715a39d10b9560fcbf3cd9081a24ddc870 (patch)
tree5953e365e797af24622c72dd7432f0ef1d13d7d6
parentinput_engine: Take BasicMotion by const reference with SetMotion() and TriggerOnMotionChange() (diff)
downloadyuzu-e826e6715a39d10b9560fcbf3cd9081a24ddc870.tar
yuzu-e826e6715a39d10b9560fcbf3cd9081a24ddc870.tar.gz
yuzu-e826e6715a39d10b9560fcbf3cd9081a24ddc870.tar.bz2
yuzu-e826e6715a39d10b9560fcbf3cd9081a24ddc870.tar.lz
yuzu-e826e6715a39d10b9560fcbf3cd9081a24ddc870.tar.xz
yuzu-e826e6715a39d10b9560fcbf3cd9081a24ddc870.tar.zst
yuzu-e826e6715a39d10b9560fcbf3cd9081a24ddc870.zip
-rw-r--r--src/input_common/input_engine.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp
index 5481607bf..fce914348 100644
--- a/src/input_common/input_engine.cpp
+++ b/src/input_common/input_engine.cpp
@@ -170,19 +170,19 @@ BasicMotion InputEngine::GetMotion(const PadIdentifier& identifier, int motion)
}
void InputEngine::ResetButtonState() {
- for (std::pair<PadIdentifier, ControllerData> controller : controller_list) {
- for (std::pair<int, bool> button : controller.second.buttons) {
+ for (const auto& controller : controller_list) {
+ for (const auto& button : controller.second.buttons) {
SetButton(controller.first, button.first, false);
}
- for (std::pair<int, bool> button : controller.second.hat_buttons) {
+ for (const auto& button : controller.second.hat_buttons) {
SetHatButton(controller.first, button.first, false);
}
}
}
void InputEngine::ResetAnalogState() {
- for (std::pair<PadIdentifier, ControllerData> controller : controller_list) {
- for (std::pair<int, float> axis : controller.second.axes) {
+ for (const auto& controller : controller_list) {
+ for (const auto& axis : controller.second.axes) {
SetAxis(controller.first, axis.first, 0.0);
}
}
@@ -190,7 +190,7 @@ void InputEngine::ResetAnalogState() {
void InputEngine::TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value) {
std::lock_guard lock{mutex_callback};
- for (const std::pair<int, InputIdentifier> poller_pair : callback_list) {
+ for (const auto& poller_pair : callback_list) {
const InputIdentifier& poller = poller_pair.second;
if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Button, button)) {
continue;
@@ -218,7 +218,7 @@ void InputEngine::TriggerOnButtonChange(const PadIdentifier& identifier, int but
void InputEngine::TriggerOnHatButtonChange(const PadIdentifier& identifier, int button, u8 value) {
std::lock_guard lock{mutex_callback};
- for (const std::pair<int, InputIdentifier> poller_pair : callback_list) {
+ for (const auto& poller_pair : callback_list) {
const InputIdentifier& poller = poller_pair.second;
if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::HatButton, button)) {
continue;
@@ -247,7 +247,7 @@ void InputEngine::TriggerOnHatButtonChange(const PadIdentifier& identifier, int
void InputEngine::TriggerOnAxisChange(const PadIdentifier& identifier, int axis, f32 value) {
std::lock_guard lock{mutex_callback};
- for (const std::pair<int, InputIdentifier> poller_pair : callback_list) {
+ for (const auto& poller_pair : callback_list) {
const InputIdentifier& poller = poller_pair.second;
if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Analog, axis)) {
continue;
@@ -274,7 +274,7 @@ void InputEngine::TriggerOnAxisChange(const PadIdentifier& identifier, int axis,
void InputEngine::TriggerOnBatteryChange(const PadIdentifier& identifier,
[[maybe_unused]] BatteryLevel value) {
std::lock_guard lock{mutex_callback};
- for (const std::pair<int, InputIdentifier> poller_pair : callback_list) {
+ for (const auto& poller_pair : callback_list) {
const InputIdentifier& poller = poller_pair.second;
if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Battery, 0)) {
continue;
@@ -288,7 +288,7 @@ void InputEngine::TriggerOnBatteryChange(const PadIdentifier& identifier,
void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int motion,
const BasicMotion& value) {
std::lock_guard lock{mutex_callback};
- for (const std::pair<int, InputIdentifier> poller_pair : callback_list) {
+ for (const auto& poller_pair : callback_list) {
const InputIdentifier& poller = poller_pair.second;
if (!IsInputIdentifierEqual(poller, identifier, EngineInputType::Motion, motion)) {
continue;