diff options
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/keyboard.cpp | 5 | ||||
| -rw-r--r-- | src/input_common/motion_emu.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/sdl/sdl.cpp | 20 |
3 files changed, 8 insertions, 19 deletions
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp index 0f0d10f23..525fe6abc 100644 --- a/src/input_common/keyboard.cpp +++ b/src/input_common/keyboard.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <atomic> | 5 | #include <atomic> |
| 6 | #include <list> | 6 | #include <list> |
| 7 | #include <mutex> | 7 | #include <mutex> |
| 8 | #include <utility> | ||
| 8 | #include "input_common/keyboard.h" | 9 | #include "input_common/keyboard.h" |
| 9 | 10 | ||
| 10 | namespace InputCommon { | 11 | namespace InputCommon { |
| @@ -12,9 +13,9 @@ namespace InputCommon { | |||
| 12 | class KeyButton final : public Input::ButtonDevice { | 13 | class KeyButton final : public Input::ButtonDevice { |
| 13 | public: | 14 | public: |
| 14 | explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_) | 15 | explicit KeyButton(std::shared_ptr<KeyButtonList> key_button_list_) |
| 15 | : key_button_list(key_button_list_) {} | 16 | : key_button_list(std::move(key_button_list_)) {} |
| 16 | 17 | ||
| 17 | ~KeyButton(); | 18 | ~KeyButton() override; |
| 18 | 19 | ||
| 19 | bool GetStatus() const override { | 20 | bool GetStatus() const override { |
| 20 | return status.load(); | 21 | return status.load(); |
diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index caffe48cb..9570c060e 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp | |||
| @@ -131,7 +131,7 @@ public: | |||
| 131 | device = std::make_shared<MotionEmuDevice>(update_millisecond, sensitivity); | 131 | device = std::make_shared<MotionEmuDevice>(update_millisecond, sensitivity); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | std::tuple<Math::Vec3<float>, Math::Vec3<float>> GetStatus() const { | 134 | std::tuple<Math::Vec3<float>, Math::Vec3<float>> GetStatus() const override { |
| 135 | return device->GetStatus(); | 135 | return device->GetStatus(); |
| 136 | } | 136 | } |
| 137 | 137 | ||
diff --git a/src/input_common/sdl/sdl.cpp b/src/input_common/sdl/sdl.cpp index 8d117c2d4..d1b960fd7 100644 --- a/src/input_common/sdl/sdl.cpp +++ b/src/input_common/sdl/sdl.cpp | |||
| @@ -82,7 +82,7 @@ private: | |||
| 82 | class SDLButton final : public Input::ButtonDevice { | 82 | class SDLButton final : public Input::ButtonDevice { |
| 83 | public: | 83 | public: |
| 84 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_) | 84 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_) |
| 85 | : joystick(joystick_), button(button_) {} | 85 | : joystick(std::move(joystick_)), button(button_) {} |
| 86 | 86 | ||
| 87 | bool GetStatus() const override { | 87 | bool GetStatus() const override { |
| 88 | return joystick->GetButton(button); | 88 | return joystick->GetButton(button); |
| @@ -96,7 +96,7 @@ private: | |||
| 96 | class SDLDirectionButton final : public Input::ButtonDevice { | 96 | class SDLDirectionButton final : public Input::ButtonDevice { |
| 97 | public: | 97 | public: |
| 98 | explicit SDLDirectionButton(std::shared_ptr<SDLJoystick> joystick_, int hat_, Uint8 direction_) | 98 | explicit SDLDirectionButton(std::shared_ptr<SDLJoystick> joystick_, int hat_, Uint8 direction_) |
| 99 | : joystick(joystick_), hat(hat_), direction(direction_) {} | 99 | : joystick(std::move(joystick_)), hat(hat_), direction(direction_) {} |
| 100 | 100 | ||
| 101 | bool GetStatus() const override { | 101 | bool GetStatus() const override { |
| 102 | return joystick->GetHatDirection(hat, direction); | 102 | return joystick->GetHatDirection(hat, direction); |
| @@ -112,7 +112,7 @@ class SDLAxisButton final : public Input::ButtonDevice { | |||
| 112 | public: | 112 | public: |
| 113 | explicit SDLAxisButton(std::shared_ptr<SDLJoystick> joystick_, int axis_, float threshold_, | 113 | explicit SDLAxisButton(std::shared_ptr<SDLJoystick> joystick_, int axis_, float threshold_, |
| 114 | bool trigger_if_greater_) | 114 | bool trigger_if_greater_) |
| 115 | : joystick(joystick_), axis(axis_), threshold(threshold_), | 115 | : joystick(std::move(joystick_)), axis(axis_), threshold(threshold_), |
| 116 | trigger_if_greater(trigger_if_greater_) {} | 116 | trigger_if_greater(trigger_if_greater_) {} |
| 117 | 117 | ||
| 118 | bool GetStatus() const override { | 118 | bool GetStatus() const override { |
| @@ -132,7 +132,7 @@ private: | |||
| 132 | class SDLAnalog final : public Input::AnalogDevice { | 132 | class SDLAnalog final : public Input::AnalogDevice { |
| 133 | public: | 133 | public: |
| 134 | SDLAnalog(std::shared_ptr<SDLJoystick> joystick_, int axis_x_, int axis_y_) | 134 | SDLAnalog(std::shared_ptr<SDLJoystick> joystick_, int axis_x_, int axis_y_) |
| 135 | : joystick(joystick_), axis_x(axis_x_), axis_y(axis_y_) {} | 135 | : joystick(std::move(joystick_)), axis_x(axis_x_), axis_y(axis_y_) {} |
| 136 | 136 | ||
| 137 | std::tuple<float, float> GetStatus() const override { | 137 | std::tuple<float, float> GetStatus() const override { |
| 138 | return joystick->GetAnalog(axis_x, axis_y); | 138 | return joystick->GetAnalog(axis_x, axis_y); |
| @@ -314,10 +314,6 @@ namespace Polling { | |||
| 314 | 314 | ||
| 315 | class SDLPoller : public InputCommon::Polling::DevicePoller { | 315 | class SDLPoller : public InputCommon::Polling::DevicePoller { |
| 316 | public: | 316 | public: |
| 317 | SDLPoller() = default; | ||
| 318 | |||
| 319 | ~SDLPoller() = default; | ||
| 320 | |||
| 321 | void Start() override { | 317 | void Start() override { |
| 322 | // SDL joysticks must be opened, otherwise they don't generate events | 318 | // SDL joysticks must be opened, otherwise they don't generate events |
| 323 | SDL_JoystickUpdate(); | 319 | SDL_JoystickUpdate(); |
| @@ -341,10 +337,6 @@ private: | |||
| 341 | 337 | ||
| 342 | class SDLButtonPoller final : public SDLPoller { | 338 | class SDLButtonPoller final : public SDLPoller { |
| 343 | public: | 339 | public: |
| 344 | SDLButtonPoller() = default; | ||
| 345 | |||
| 346 | ~SDLButtonPoller() = default; | ||
| 347 | |||
| 348 | Common::ParamPackage GetNextInput() override { | 340 | Common::ParamPackage GetNextInput() override { |
| 349 | SDL_Event event; | 341 | SDL_Event event; |
| 350 | while (SDL_PollEvent(&event)) { | 342 | while (SDL_PollEvent(&event)) { |
| @@ -364,10 +356,6 @@ public: | |||
| 364 | 356 | ||
| 365 | class SDLAnalogPoller final : public SDLPoller { | 357 | class SDLAnalogPoller final : public SDLPoller { |
| 366 | public: | 358 | public: |
| 367 | SDLAnalogPoller() = default; | ||
| 368 | |||
| 369 | ~SDLAnalogPoller() = default; | ||
| 370 | |||
| 371 | void Start() override { | 359 | void Start() override { |
| 372 | SDLPoller::Start(); | 360 | SDLPoller::Start(); |
| 373 | 361 | ||