input_common/sdl: Use a type alias to shorten declaration of GetPollers
Just makes the definitions a little bit more tidy.
This commit is contained in:
parent
8dc2f01eae
commit
874826b6dd
|
@ -24,17 +24,17 @@ namespace InputCommon::SDL {
|
||||||
|
|
||||||
class State {
|
class State {
|
||||||
public:
|
public:
|
||||||
/// Unresisters SDL device factories and shut them down.
|
using Pollers = std::vector<std::unique_ptr<Polling::DevicePoller>>;
|
||||||
|
|
||||||
|
/// Unregisters SDL device factories and shut them down.
|
||||||
virtual ~State() = default;
|
virtual ~State() = default;
|
||||||
|
|
||||||
virtual std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers(
|
virtual Pollers GetPollers(Polling::DeviceType type) = 0;
|
||||||
InputCommon::Polling::DeviceType type) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NullState : public State {
|
class NullState : public State {
|
||||||
public:
|
public:
|
||||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers(
|
Pollers GetPollers(Polling::DeviceType type) override {}
|
||||||
InputCommon::Polling::DeviceType type) override {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<State> Init();
|
std::unique_ptr<State> Init();
|
||||||
|
|
|
@ -650,9 +650,8 @@ private:
|
||||||
};
|
};
|
||||||
} // namespace Polling
|
} // namespace Polling
|
||||||
|
|
||||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> SDLState::GetPollers(
|
SDLState::Pollers SDLState::GetPollers(InputCommon::Polling::DeviceType type) {
|
||||||
InputCommon::Polling::DeviceType type) {
|
Pollers pollers;
|
||||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> pollers;
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case InputCommon::Polling::DeviceType::Analog:
|
case InputCommon::Polling::DeviceType::Analog:
|
||||||
pollers.emplace_back(std::make_unique<Polling::SDLAnalogPoller>(*this));
|
pollers.emplace_back(std::make_unique<Polling::SDLAnalogPoller>(*this));
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
/// Initializes and registers SDL device factories
|
/// Initializes and registers SDL device factories
|
||||||
SDLState();
|
SDLState();
|
||||||
|
|
||||||
/// Unresisters SDL device factories and shut them down.
|
/// Unregisters SDL device factories and shut them down.
|
||||||
~SDLState() override;
|
~SDLState() override;
|
||||||
|
|
||||||
/// Handle SDL_Events for joysticks from SDL_PollEvent
|
/// Handle SDL_Events for joysticks from SDL_PollEvent
|
||||||
|
@ -35,8 +35,7 @@ public:
|
||||||
std::shared_ptr<SDLJoystick> GetSDLJoystickByGUID(const std::string& guid, int port);
|
std::shared_ptr<SDLJoystick> GetSDLJoystickByGUID(const std::string& guid, int port);
|
||||||
|
|
||||||
/// Get all DevicePoller that use the SDL backend for a specific device type
|
/// Get all DevicePoller that use the SDL backend for a specific device type
|
||||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>> GetPollers(
|
Pollers GetPollers(Polling::DeviceType type) override;
|
||||||
InputCommon::Polling::DeviceType type) override;
|
|
||||||
|
|
||||||
/// Used by the Pollers during config
|
/// Used by the Pollers during config
|
||||||
std::atomic<bool> polling = false;
|
std::atomic<bool> polling = false;
|
||||||
|
|
Reference in New Issue