From 9e83411f7e4147d09af5a5006888dcc187ea0ef8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 7 Nov 2011 19:34:52 +0300 Subject: Fix some warnings under gcc 4.7. --- src/debug.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/debug.h') diff --git a/src/debug.h b/src/debug.h index 81a2e0526..3c509152d 100644 --- a/src/debug.h +++ b/src/debug.h @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#include "localconsts.h" + #ifdef ENABLE_MEM_DEBUG //define _DEBUG_NEW_EMULATE_MALLOC 1 #include "debug/debug_new.h" -- cgit v1.2.3-70-g09d2 From 4faba7f0df6abf47477d5408637103cd61df68a6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Nov 2011 21:50:33 +0300 Subject: Add code for joystick debug. --- src/debug.h | 2 ++ src/joystick.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src/debug.h') diff --git a/src/debug.h b/src/debug.h index 3c509152d..00a0ec3d0 100644 --- a/src/debug.h +++ b/src/debug.h @@ -20,6 +20,8 @@ #include "localconsts.h" +//#define DEBUG_JOYSTICK 1 + #ifdef ENABLE_MEM_DEBUG //define _DEBUG_NEW_EMULATE_MALLOC 1 #include "debug/debug_new.h" 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 { -- cgit v1.2.3-70-g09d2