Do not need SDL Joystick module unless built with USE_JOYSTICK

This commit is contained in:
Thomas Bernard 2019-01-23 16:48:46 +01:00
parent 51c5a7ea8f
commit 08b2448e33
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -142,7 +142,7 @@ extern char Program_version[]; // generated in pversion.c
static int setsize_width;
static int setsize_height;
#if defined(USE_SDL) || defined(USE_SDL2)
#if (defined(USE_SDL) || defined(USE_SDL2)) && defined(USE_JOYSTICK)
/// Pointer to the current joystick controller.
static SDL_Joystick* Joystick;
#endif
@ -728,7 +728,11 @@ int Init_program(int argc,char * argv[])
#if defined(USE_SDL) || defined(USE_SDL2)
// SDL
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0)
if (SDL_Init(SDL_INIT_VIDEO
#if defined(USE_JOYSTICK)
| SDL_INIT_JOYSTICK
#endif
) < 0)
{
// The program can't continue without that anyway
printf("Couldn't initialize SDL.\n");
@ -738,8 +742,10 @@ int Init_program(int argc,char * argv[])
#if defined(USE_SDL2)
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE);
#endif
#if defined(USE_JOYSTICK)
Joystick = SDL_JoystickOpen(0);
#endif
#endif
#if defined(USE_SDL)
SDL_EnableKeyRepeat(250, 32);
SDL_EnableUNICODE(SDL_ENABLE);