InputCommon: add SDL joystick support
This commit is contained in:
parent
a6bd7917cb
commit
51b1c1f211
4 changed files with 241 additions and 0 deletions
|
@ -7,6 +7,9 @@
|
|||
#include "input_common/analog_from_button.h"
|
||||
#include "input_common/keyboard.h"
|
||||
#include "input_common/main.h"
|
||||
#ifdef HAVE_SDL2
|
||||
#include "input_common/sdl/sdl.h"
|
||||
#endif
|
||||
|
||||
namespace InputCommon {
|
||||
|
||||
|
@ -17,12 +20,19 @@ void Init() {
|
|||
Input::RegisterFactory<Input::ButtonDevice>("keyboard", keyboard);
|
||||
Input::RegisterFactory<Input::AnalogDevice>("analog_from_button",
|
||||
std::make_shared<InputCommon::AnalogFromButton>());
|
||||
#ifdef HAVE_SDL2
|
||||
SDL::Init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown() {
|
||||
Input::UnregisterFactory<Input::ButtonDevice>("keyboard");
|
||||
keyboard.reset();
|
||||
Input::UnregisterFactory<Input::AnalogDevice>("analog_from_button");
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
SDL::Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
Keyboard* GetKeyboard() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue