diff options
Diffstat (limited to 'src/core/frontend/motion_emu.h')
| -rw-r--r-- | src/core/frontend/motion_emu.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/core/frontend/motion_emu.h b/src/core/frontend/motion_emu.h new file mode 100644 index 000000000..99d41a726 --- /dev/null +++ b/src/core/frontend/motion_emu.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | #include "common/thread.h" | ||
| 7 | #include "common/vector_math.h" | ||
| 8 | |||
| 9 | class EmuWindow; | ||
| 10 | |||
| 11 | namespace Motion { | ||
| 12 | |||
| 13 | class MotionEmu final { | ||
| 14 | public: | ||
| 15 | MotionEmu(EmuWindow& emu_window); | ||
| 16 | ~MotionEmu(); | ||
| 17 | |||
| 18 | /** | ||
| 19 | * Signals that a motion sensor tilt has begun. | ||
| 20 | * @param x the x-coordinate of the cursor | ||
| 21 | * @param y the y-coordinate of the cursor | ||
| 22 | */ | ||
| 23 | void BeginTilt(int x, int y); | ||
| 24 | |||
| 25 | /** | ||
| 26 | * Signals that a motion sensor tilt is occurring. | ||
| 27 | * @param x the x-coordinate of the cursor | ||
| 28 | * @param y the y-coordinate of the cursor | ||
| 29 | */ | ||
| 30 | void Tilt(int x, int y); | ||
| 31 | |||
| 32 | /** | ||
| 33 | * Signals that a motion sensor tilt has ended. | ||
| 34 | */ | ||
| 35 | void EndTilt(); | ||
| 36 | |||
| 37 | private: | ||
| 38 | Math::Vec2<int> mouse_origin; | ||
| 39 | |||
| 40 | std::mutex tilt_mutex; | ||
| 41 | Math::Vec2<float> tilt_direction; | ||
| 42 | float tilt_angle = 0; | ||
| 43 | |||
| 44 | bool is_tilting = false; | ||
| 45 | |||
| 46 | Common::Event shutdown_event; | ||
| 47 | std::thread motion_emu_thread; | ||
| 48 | |||
| 49 | void MotionEmuThread(EmuWindow& emu_window); | ||
| 50 | }; | ||
| 51 | |||
| 52 | } // namespace Motion | ||