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
1 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
void SetButton(int button, bool value) {
|
void SetButton(int button, bool value) {
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
state.buttons[button] = value;
|
state.buttons.insert_or_assign(button, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetButton(int button) const {
|
bool GetButton(int button) const {
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
void SetAxis(int axis, Sint16 value) {
|
void SetAxis(int axis, Sint16 value) {
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
state.axes[axis] = value;
|
state.axes.insert_or_assign(axis, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetAxis(int axis) const {
|
float GetAxis(int axis) const {
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
|
|
||||||
void SetHat(int hat, Uint8 direction) {
|
void SetHat(int hat, Uint8 direction) {
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
state.hats[hat] = direction;
|
state.hats.insert_or_assign(hat, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetHatDirection(int hat, Uint8 direction) const {
|
bool GetHatDirection(int hat, Uint8 direction) const {
|
||||||
|
|
Loading…
Reference in a new issue