diff options
Diffstat (limited to 'src/input_common/sdl/sdl_impl.h')
| -rw-r--r-- | src/input_common/sdl/sdl_impl.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/input_common/sdl/sdl_impl.h b/src/input_common/sdl/sdl_impl.h new file mode 100644 index 000000000..c152fa747 --- /dev/null +++ b/src/input_common/sdl/sdl_impl.h | |||
| @@ -0,0 +1,51 @@ | |||
| 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 <memory> | ||
| 8 | #include <vector> | ||
| 9 | #include "core/frontend/input.h" | ||
| 10 | |||
| 11 | union SDL_Event; | ||
| 12 | namespace Common { | ||
| 13 | class ParamPackage; | ||
| 14 | } | ||
| 15 | namespace InputCommon { | ||
| 16 | namespace Polling { | ||
| 17 | class DevicePoller; | ||
| 18 | enum class DeviceType; | ||
| 19 | } // namespace Polling | ||
| 20 | } // namespace InputCommon | ||
| 21 | |||
| 22 | namespace InputCommon { | ||
| 23 | namespace SDL { | ||
| 24 | |||
| 25 | /// Initializes and registers SDL device factories | ||
| 26 | void Init(); | ||
| 27 | |||
| 28 | /// Unresisters SDL device factories and shut them down. | ||
| 29 | void Shutdown(); | ||
| 30 | |||
| 31 | /// Needs to be called before SDL_QuitSubSystem. | ||
| 32 | void CloseSDLJoysticks(); | ||
| 33 | |||
| 34 | /// Handle SDL_Events for joysticks from SDL_PollEvent | ||
| 35 | void HandleGameControllerEvent(const SDL_Event& event); | ||
| 36 | |||
| 37 | /// A Loop that calls HandleGameControllerEvent until Shutdown is called | ||
| 38 | void PollLoop(); | ||
| 39 | |||
| 40 | /// Creates a ParamPackage from an SDL_Event that can directly be used to create a ButtonDevice | ||
| 41 | Common::ParamPackage SDLEventToButtonParamPackage(const SDL_Event& event); | ||
| 42 | |||
| 43 | namespace Polling { | ||
| 44 | |||
| 45 | /// Get all DevicePoller that use the SDL backend for a specific device type | ||
| 46 | void GetPollers(InputCommon::Polling::DeviceType type, | ||
| 47 | std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>>& pollers); | ||
| 48 | |||
| 49 | } // namespace Polling | ||
| 50 | } // namespace SDL | ||
| 51 | } // namespace InputCommon | ||