diff options
Diffstat (limited to 'src/client/joystick.cc')
-rw-r--r-- | src/client/joystick.cc | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/client/joystick.cc b/src/client/joystick.cc index c8f7f9d..0ea05a8 100644 --- a/src/client/joystick.cc +++ b/src/client/joystick.cc @@ -8,14 +8,24 @@ #include "auxiliary/functions.h" #include "client/joystick.h" -#include "core/cvar.h" + #include "sys/sys.h" namespace client { -core::Cvar *input_joystick = 0; +// configured joystick number +core::Cvar *Joystick::input_joystick = 0; + +// joystick axes +core::Cvar *Joystick::input_axisdirection = 0; +core::Cvar *Joystick::input_axispitch = 0; +core::Cvar *Joystick::input_axisroll = 0; +core::Cvar *Joystick::input_axisthrottle = 0; + +// current joystick number int current_joystick_number = 0; + SDL_Joystick *current_joystick = 0; void Joystick::init() @@ -40,6 +50,18 @@ void Joystick::init() input_joystick = core::Cvar::get("input_joystick", 0.0f, core::Cvar::Archive); input_joystick->set_info("[int] set joystick number to use"); + input_axisdirection = core::Cvar::get("input_axisdirection", 1.0f, core::Cvar::Archive); + input_axisdirection->set_info("[int] joystick axis for direction control, 0 disables"); + + input_axispitch = core::Cvar::get("input_axispitch", 2.0f, core::Cvar::Archive); + input_axispitch->set_info("[int] joystick axis for pitch control, 0 disables"); + + input_axisroll = core::Cvar::get("input_axisroll", 3.0f, core::Cvar::Archive); + input_axisroll->set_info("[int] joystick axis for roll control, 0 disables"); + + input_axisthrottle = core::Cvar::get("input_axisthrottle", 4.0f, core::Cvar::Archive); + input_axisthrottle->set_info("[int] joystick axis for throttle control, 0 disables"); + current_joystick_number = 0; SDL_JoystickEventState(SDL_IGNORE); } |