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/sdl/sdl.h | |
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/sdl/sdl.h | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/src/input_common/sdl/sdl.h b/src/input_common/sdl/sdl.h index 0206860d3..02a8d2e2c 100644 --- a/src/input_common/sdl/sdl.h +++ b/src/input_common/sdl/sdl.h @@ -1,4 +1,4 @@ -// Copyright 2017 Citra Emulator Project +// Copyright 2018 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -7,45 +7,36 @@ #include <memory> #include <vector> #include "core/frontend/input.h" +#include "input_common/main.h" union SDL_Event; + namespace Common { class ParamPackage; -} -namespace InputCommon { -namespace Polling { +} // namespace Common + +namespace InputCommon::Polling { class DevicePoller; enum class DeviceType; -} // namespace Polling -} // namespace InputCommon - -namespace InputCommon { -namespace SDL { - -/// Initializes and registers SDL device factories -void Init(); - -/// Unresisters SDL device factories and shut them down. -void Shutdown(); - -/// Needs to be called before SDL_QuitSubSystem. -void CloseSDLJoysticks(); +} // namespace InputCommon::Polling -/// Handle SDL_Events for joysticks from SDL_PollEvent -void HandleGameControllerEvent(const SDL_Event& event); +namespace InputCommon::SDL { -/// A Loop that calls HandleGameControllerEvent until Shutdown is called -void PollLoop(); +class State { +public: + /// Unresisters SDL device factories and shut them down. + virtual ~State() = default; -/// Creates a ParamPackage from an SDL_Event that can directly be used to create a ButtonDevice -Common::ParamPackage SDLEventToButtonParamPackage(const SDL_Event& event); + virtual std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers( + InputCommon::Polling::DeviceType type) = 0; +}; -namespace Polling { +class NullState : public State { +public: + std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers( + InputCommon::Polling::DeviceType type) override {} +}; -/// Get all DevicePoller that use the SDL backend for a specific device type -std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers( - InputCommon::Polling::DeviceType type); +std::unique_ptr<State> Init(); -} // namespace Polling -} // namespace SDL -} // namespace InputCommon +} // namespace InputCommon::SDL |