Initial support for "haptic" (force feedback) devices.
[supertux.git] / src / supertux / main.cpp
index 98a6cc3..48c2b7e 100644 (file)
@@ -17,6 +17,7 @@
 #include <config.h>
 #include <version.h>
 
+#include <SDL.h>
 #include <SDL_image.h>
 #include <physfs.h>
 #include <iostream>
@@ -34,6 +35,7 @@ namespace supertux_apple {
 #include "addon/addon_manager.hpp"
 #include "audio/sound_manager.hpp"
 #include "control/joystickkeyboardcontroller.hpp"
+#include "control/haptic_manager.hpp"
 #include "math/random_generator.hpp"
 #include "physfs/ifile_stream.hpp"
 #include "physfs/physfs_sdl.hpp"
@@ -399,7 +401,7 @@ Main::parse_commandline(int argc, char** argv)
 void
 Main::init_sdl()
 {
-  if(SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
+  if(SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0) {
     std::stringstream msg;
     msg << "Couldn't initialize SDL: " << SDL_GetError();
     throw std::runtime_error(msg.str());
@@ -555,6 +557,9 @@ Main::run(int argc, char** argv)
     init_physfs(argv[0]);
     init_sdl();
 
+    timelog("haptic");
+    g_haptic_manager = new HapticManager();
+
     timelog("controller");
     g_main_controller = new JoystickKeyboardController();