summaryrefslogtreecommitdiff
path: root/src/citra/emu_window/emu_window_sdl2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra/emu_window/emu_window_sdl2.cpp')
-rw-r--r--src/citra/emu_window/emu_window_sdl2.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp
index b0d82b670..81a3abe3f 100644
--- a/src/citra/emu_window/emu_window_sdl2.cpp
+++ b/src/citra/emu_window/emu_window_sdl2.cpp
@@ -19,16 +19,22 @@
19 19
20void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) { 20void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) {
21 TouchMoved((unsigned)std::max(x, 0), (unsigned)std::max(y, 0)); 21 TouchMoved((unsigned)std::max(x, 0), (unsigned)std::max(y, 0));
22 motion_emu->Tilt(x, y);
22} 23}
23 24
24void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) { 25void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) {
25 if (button != SDL_BUTTON_LEFT) 26 if (button == SDL_BUTTON_LEFT) {
26 return; 27 if (state == SDL_PRESSED) {
27 28 TouchPressed((unsigned)std::max(x, 0), (unsigned)std::max(y, 0));
28 if (state == SDL_PRESSED) { 29 } else {
29 TouchPressed((unsigned)std::max(x, 0), (unsigned)std::max(y, 0)); 30 TouchReleased();
30 } else { 31 }
31 TouchReleased(); 32 } else if (button == SDL_BUTTON_RIGHT) {
33 if (state == SDL_PRESSED) {
34 motion_emu->BeginTilt(x, y);
35 } else {
36 motion_emu->EndTilt();
37 }
32 } 38 }
33} 39}
34 40
@@ -54,6 +60,7 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
54 keyboard_id = KeyMap::NewDeviceId(); 60 keyboard_id = KeyMap::NewDeviceId();
55 61
56 ReloadSetKeymaps(); 62 ReloadSetKeymaps();
63 motion_emu = std::make_unique<Motion::MotionEmu>(*this);
57 64
58 SDL_SetMainReady(); 65 SDL_SetMainReady();
59 66
@@ -109,6 +116,7 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
109EmuWindow_SDL2::~EmuWindow_SDL2() { 116EmuWindow_SDL2::~EmuWindow_SDL2() {
110 SDL_GL_DeleteContext(gl_context); 117 SDL_GL_DeleteContext(gl_context);
111 SDL_Quit(); 118 SDL_Quit();
119 motion_emu = nullptr;
112} 120}
113 121
114void EmuWindow_SDL2::SwapBuffers() { 122void EmuWindow_SDL2::SwapBuffers() {