supertux/main, control/haptic_manager: Add SDL 1.2 compatibility code.
[supertux.git] / src / control / haptic_manager.cpp
index 826d3ff..cda5782 100644 (file)
@@ -19,6 +19,7 @@
 #include "control/haptic_manager.hpp"
 #include "util/log.hpp"
 
+#if SDL_VERSION_ATLEAST(1,3,0)
 HapticManager::HapticManager () /* {{{ */
 {
   int i;
@@ -90,5 +91,20 @@ void HapticManager::playEffect (haptic_effect_t idx) { /* {{{ */
   SDL_HapticRunEffect (_device, _effect_ids[idx],
       /* iterations = */ 1);
 } /* }}} void playEffect */
+#else /* if SDL < 1.3 */
+/* If the SDL version is too old, provide dummy methods that don't to anything.
+ * This avoid using defines all over the place. */
+HapticManager::HapticManager () {
+  log_debug << "Haptic manager: Disabled because SDL version is too old." << std::endl;
+}
+
+void HapticManager::addJoystick (SDL_Joystick *j) {
+  /* do nothing. */
+}
+
+void HapticManager::playEffect (haptic_effect_t idx) {
+  /* do nothing. */
+}
+#endif /* SDL < 1.3 */
 
 /* vim: set sw=2 sts=2 et fdm=marker : */