diff options
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/motion_emu.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/input_common/motion_emu.h b/src/input_common/motion_emu.h new file mode 100644 index 000000000..7a7e22467 --- /dev/null +++ b/src/input_common/motion_emu.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/frontend/input.h" | ||
| 8 | |||
| 9 | namespace InputCommon { | ||
| 10 | |||
| 11 | class MotionEmuDevice; | ||
| 12 | |||
| 13 | class MotionEmu : public Input::Factory<Input::MotionDevice> { | ||
| 14 | public: | ||
| 15 | /** | ||
| 16 | * Creates a motion device emulated from mouse input | ||
| 17 | * @param params contains parameters for creating the device: | ||
| 18 | * - "update_period": update period in milliseconds | ||
| 19 | * - "sensitivity": the coefficient converting mouse movement to tilting angle | ||
| 20 | */ | ||
| 21 | std::unique_ptr<Input::MotionDevice> Create(const Common::ParamPackage& params) override; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Signals that a motion sensor tilt has begun. | ||
| 25 | * @param x the x-coordinate of the cursor | ||
| 26 | * @param y the y-coordinate of the cursor | ||
| 27 | */ | ||
| 28 | void BeginTilt(int x, int y); | ||
| 29 | |||
| 30 | /** | ||
| 31 | * Signals that a motion sensor tilt is occurring. | ||
| 32 | * @param x the x-coordinate of the cursor | ||
| 33 | * @param y the y-coordinate of the cursor | ||
| 34 | */ | ||
| 35 | void Tilt(int x, int y); | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Signals that a motion sensor tilt has ended. | ||
| 39 | */ | ||
| 40 | void EndTilt(); | ||
| 41 | |||
| 42 | private: | ||
| 43 | std::weak_ptr<MotionEmuDevice> current_device; | ||
| 44 | }; | ||
| 45 | |||
| 46 | } // namespace InputCommon | ||