Skip to content
Permalink
Browse files

Add option to disable joystick input

  • Loading branch information...
BevapDin committed Jul 5, 2014
1 parent ef62c60 commit aafb6d767b95ccf8226a029c8cad030147c95653
Showing with 10 additions and 7 deletions.
  1. +5 −0 src/options.cpp
  2. +5 −7 src/sdltiles.cpp
@@ -710,6 +710,11 @@ void initOptions()
false
);

OPTIONS["ENABLE_JOYSTICK"] = cOpt("interface", _("Enable Joystick"),
_("SDL ONLY: Enable input from joystick."),
true
);

//~ show mouse cursor
optionNames["show"] = _("Show");
//~ hide mouse cursor
@@ -284,18 +284,16 @@ bool WinCreate()
// Initialize joysticks.
int numjoy = SDL_NumJoysticks();

if(numjoy > 1) {
DebugLog() << "You have more than one gamepads/joysticks plugged in, only the first will be used.\n";
}

if(numjoy >= 1) {
if( OPTIONS["ENABLE_JOYSTICK"] && numjoy >= 1 ) {
if( numjoy > 1 ) {
DebugLog() << "You have more than one gamepads/joysticks plugged in, only the first will be used.\n";
}
joystick = SDL_JoystickOpen(0);
SDL_JoystickEventState(SDL_ENABLE);
} else {
joystick = NULL;
}

SDL_JoystickEventState(SDL_ENABLE);

// Set up audio mixer.
#ifdef SDL_SOUND
int audio_rate = 22050;

0 comments on commit aafb6d7

Please sign in to comment.
You can’t perform that action at this time.