diff options
author | bunnei <bunneidev@gmail.com> | 2020-08-28 15:57:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 15:57:50 +0200 |
commit | 45b73ba840411fa61c75e6fe954b9a46ca5d59b6 (patch) | |
tree | c99333f0b6b386bfb80712d8e6ffa94bef04a9ff /src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | |
parent | Merge pull request #4586 from yuzu-emu/tsan-cpu-interrupt (diff) | |
parent | input_common: Eliminate most global state (diff) | |
download | yuzu-45b73ba840411fa61c75e6fe954b9a46ca5d59b6.tar yuzu-45b73ba840411fa61c75e6fe954b9a46ca5d59b6.tar.gz yuzu-45b73ba840411fa61c75e6fe954b9a46ca5d59b6.tar.bz2 yuzu-45b73ba840411fa61c75e6fe954b9a46ca5d59b6.tar.lz yuzu-45b73ba840411fa61c75e6fe954b9a46ca5d59b6.tar.xz yuzu-45b73ba840411fa61c75e6fe954b9a46ca5d59b6.tar.zst yuzu-45b73ba840411fa61c75e6fe954b9a46ca5d59b6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index e5e684206..a804d5185 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -13,23 +13,25 @@ #include "input_common/sdl/sdl.h" #include "yuzu_cmd/emu_window/emu_window_sdl2.h" -EmuWindow_SDL2::EmuWindow_SDL2(Core::System& system, bool fullscreen) : system{system} { +EmuWindow_SDL2::EmuWindow_SDL2(Core::System& system, bool fullscreen, + InputCommon::InputSubsystem* input_subsystem_) + : system{system}, input_subsystem{input_subsystem_} { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting..."); exit(1); } - InputCommon::Init(); + input_subsystem->Initialize(); SDL_SetMainReady(); } EmuWindow_SDL2::~EmuWindow_SDL2() { - InputCommon::Shutdown(); + input_subsystem->Shutdown(); SDL_Quit(); } void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) { TouchMoved((unsigned)std::max(x, 0), (unsigned)std::max(y, 0)); - InputCommon::GetMotionEmu()->Tilt(x, y); + input_subsystem->GetMotionEmu()->Tilt(x, y); } void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) { @@ -41,9 +43,9 @@ void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) { } } else if (button == SDL_BUTTON_RIGHT) { if (state == SDL_PRESSED) { - InputCommon::GetMotionEmu()->BeginTilt(x, y); + input_subsystem->GetMotionEmu()->BeginTilt(x, y); } else { - InputCommon::GetMotionEmu()->EndTilt(); + input_subsystem->GetMotionEmu()->EndTilt(); } } } @@ -79,9 +81,9 @@ void EmuWindow_SDL2::OnFingerUp() { void EmuWindow_SDL2::OnKeyEvent(int key, u8 state) { if (state == SDL_PRESSED) { - InputCommon::GetKeyboard()->PressKey(key); + input_subsystem->GetKeyboard()->PressKey(key); } else if (state == SDL_RELEASED) { - InputCommon::GetKeyboard()->ReleaseKey(key); + input_subsystem->GetKeyboard()->ReleaseKey(key); } } |