diff options
author | James Rowe <jroweboy@gmail.com> | 2018-09-20 08:28:05 +0200 |
---|---|---|
committer | fearlessTobi <thm.frey@gmail.com> | 2019-03-02 19:09:34 +0100 |
commit | 09ac66388c01187ed6a402efcad76984c8af9a2e (patch) | |
tree | beed8a86e7b7e02e0c5526723bbf812920341d12 /src/input_common/main.cpp | |
parent | Input: Copy current SDL.h/cpp files to impl (diff) | |
download | yuzu-09ac66388c01187ed6a402efcad76984c8af9a2e.tar yuzu-09ac66388c01187ed6a402efcad76984c8af9a2e.tar.gz yuzu-09ac66388c01187ed6a402efcad76984c8af9a2e.tar.bz2 yuzu-09ac66388c01187ed6a402efcad76984c8af9a2e.tar.lz yuzu-09ac66388c01187ed6a402efcad76984c8af9a2e.tar.xz yuzu-09ac66388c01187ed6a402efcad76984c8af9a2e.tar.zst yuzu-09ac66388c01187ed6a402efcad76984c8af9a2e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/input_common/main.cpp | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 37f572853..8e66c1b15 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp @@ -17,10 +17,7 @@ namespace InputCommon { static std::shared_ptr<Keyboard> keyboard; static std::shared_ptr<MotionEmu> motion_emu; - -#ifdef HAVE_SDL2 -static std::thread poll_thread; -#endif +static std::unique_ptr<SDL::State> sdl; void Init() { keyboard = std::make_shared<Keyboard>(); @@ -30,15 +27,7 @@ void Init() { motion_emu = std::make_shared<MotionEmu>(); Input::RegisterFactory<Input::MotionDevice>("motion_emu", motion_emu); -#ifdef HAVE_SDL2 - SDL::Init(); -#endif -} - -void StartJoystickEventHandler() { -#ifdef HAVE_SDL2 - poll_thread = std::thread(SDL::PollLoop); -#endif + sdl = SDL::Init(); } void Shutdown() { @@ -47,11 +36,7 @@ void Shutdown() { Input::UnregisterFactory<Input::AnalogDevice>("analog_from_button"); Input::UnregisterFactory<Input::MotionDevice>("motion_emu"); motion_emu.reset(); - -#ifdef HAVE_SDL2 - SDL::Shutdown(); - poll_thread.join(); -#endif + sdl.reset(); } Keyboard* GetKeyboard() { @@ -88,7 +73,7 @@ namespace Polling { std::vector<std::unique_ptr<DevicePoller>> GetPollers(DeviceType type) { #ifdef HAVE_SDL2 - return SDL::Polling::GetPollers(type); + return sdl->GetPollers(type); #else return {}; #endif |