supertux/main, control/haptic_manager: Add SDL 1.2 compatibility code.
[supertux.git] / src / supertux / main.cpp
index 48c2b7e..1a05161 100644 (file)
@@ -401,7 +401,14 @@ Main::parse_commandline(int argc, char** argv)
 void
 Main::init_sdl()
 {
-  if(SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0) {
+  int init_flags;
+
+  init_flags = SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK;
+#ifdef SDL_INIT_HAPTIC
+  init_flags |= SDL_INIT_HAPTIC;
+#endif
+
+  if(SDL_Init(init_flags) < 0) {
     std::stringstream msg;
     msg << "Couldn't initialize SDL: " << SDL_GetError();
     throw std::runtime_error(msg.str());