summaryrefslogtreecommitdiff
path: root/src/joystick.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-09 21:50:33 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-09 21:50:33 +0300
commit4faba7f0df6abf47477d5408637103cd61df68a6 (patch)
tree3dfcdb83bb9ad266e0ef5d969ce853418be3ecb8 /src/joystick.cpp
parentcda0e9f6f9b9461f87af33f8a2f46c4464d473b5 (diff)
downloadmv-4faba7f0df6abf47477d5408637103cd61df68a6.tar.gz
mv-4faba7f0df6abf47477d5408637103cd61df68a6.tar.bz2
mv-4faba7f0df6abf47477d5408637103cd61df68a6.tar.xz
mv-4faba7f0df6abf47477d5408637103cd61df68a6.zip
Add code for joystick debug.
Diffstat (limited to 'src/joystick.cpp')
-rw-r--r--src/joystick.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/joystick.cpp b/src/joystick.cpp
index 6925ca27e..52d2f415b 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -167,6 +167,15 @@ void Joystick::update()
else if (position >= mDownTolerance)
mDirection |= DOWN;
+#ifdef DEBUG_JOYSTICK
+ if (SDL_JoystickGetAxis(mJoystick, 2))
+ logger->log("axis 2 pos: %d", SDL_JoystickGetAxis(mJoystick, 2));
+ if (SDL_JoystickGetAxis(mJoystick, 3))
+ logger->log("axis 3 pos: %d", SDL_JoystickGetAxis(mJoystick, 3));
+ if (SDL_JoystickGetAxis(mJoystick, 4))
+ logger->log("axis 4 pos: %d", SDL_JoystickGetAxis(mJoystick, 4));
+#endif
+
if (!mDirection && mHaveHats)
{
// reading only hat 0
@@ -183,7 +192,13 @@ void Joystick::update()
// Buttons
for (int i = 0; i < mButtonsNumber; i++)
+ {
mButtons[i] = (SDL_JoystickGetButton(mJoystick, i) == 1);
+#ifdef DEBUG_JOYSTICK
+ if (mButtons[i])
+ logger->log("button: %d", i);
+#endif
+ }
}
else
{