summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2013-08-15 22:18:40 +0200
committerPierre Bourdon <delroth@gmail.com>2013-08-15 22:18:40 +0200
commitc3065ecb6697de5a0afda5f39d8231f1ff5d6513 (patch)
tree80290a913a7bf498154209527a183687a3dd9b0a /Source/Core/InputCommon/Src/ControllerInterface
parent10f6117905f8e73b03ee997a5230096029918964 (diff)
Fix compatibility with the SDL2.0 release.
SDL2.0 removed SDL_HAPTIC_SQUARE because of ABI issues (see comment #7 on issue 6491 by Ryan C. Gordon from the SDL project). It will be reintroduced again in 2.1, so keep the code and #ifdef it away.
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp6
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
index 006b82d4ac..40c822c577 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
@@ -131,12 +131,14 @@ Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index, const unsi
AddOutput(new SineEffect(m_state_out.back()));
}
+#ifdef SDL_HAPTIC_SQUARE
// square effect
if (supported_effects & SDL_HAPTIC_SQUARE)
{
m_state_out.push_back(EffectIDState());
AddOutput(new SquareEffect(m_state_out.back()));
}
+#endif // defined(SDL_HAPTIC_SQUARE)
// triangle effect
if (supported_effects & SDL_HAPTIC_TRIANGLE)
@@ -187,10 +189,12 @@ std::string Joystick::SineEffect::GetName() const
return "Sine";
}
+#ifdef SDL_HAPTIC_SQUARE
std::string Joystick::SquareEffect::GetName() const
{
return "Square";
}
+#endif // defined(SDL_HAPTIC_SQUARE)
std::string Joystick::TriangleEffect::GetName() const
{
@@ -255,6 +259,7 @@ void Joystick::SineEffect::SetState(const ControlState state)
m_effect.changed = true;
}
+#ifdef SDL_HAPTIC_SQUARE
void Joystick::SquareEffect::SetState(const ControlState state)
{
if (state)
@@ -276,6 +281,7 @@ void Joystick::SquareEffect::SetState(const ControlState state)
if (old != m_effect.effect.periodic.magnitude)
m_effect.changed = true;
}
+#endif // defined(SDL_HAPTIC_SQUARE)
void Joystick::TriangleEffect::SetState(const ControlState state)
{
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h
index 6a65efeedb..9b9794c481 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h
+++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h
@@ -106,6 +106,7 @@ private:
EffectIDState& m_effect;
};
+#ifdef SDL_HAPTIC_SQUARE
class SquareEffect : public Output
{
public:
@@ -115,6 +116,7 @@ private:
private:
EffectIDState& m_effect;
};
+#endif // defined(SDL_HAPTIC_SQUARE)
class TriangleEffect : public Output
{