mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
input_common/sdl/sdl_impl: Use insert_or_assign() where applicable
Same behavior, but without a potential need to unnecessarily default construct a value.
This commit is contained in:
parent
b46e615551
commit
2c679cda51
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
void SetButton(int button, bool value) {
|
||||
std::lock_guard lock{mutex};
|
||||
state.buttons[button] = value;
|
||||
state.buttons.insert_or_assign(button, value);
|
||||
}
|
||||
|
||||
bool GetButton(int button) const {
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
void SetAxis(int axis, Sint16 value) {
|
||||
std::lock_guard lock{mutex};
|
||||
state.axes[axis] = value;
|
||||
state.axes.insert_or_assign(axis, value);
|
||||
}
|
||||
|
||||
float GetAxis(int axis) const {
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
void SetHat(int hat, Uint8 direction) {
|
||||
std::lock_guard lock{mutex};
|
||||
state.hats[hat] = direction;
|
||||
state.hats.insert_or_assign(hat, direction);
|
||||
}
|
||||
|
||||
bool GetHatDirection(int hat, Uint8 direction) const {
|
||||
|
|
Loading…
Reference in a new issue