Added command line option to activate some gamepad debug output.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2743 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4cebdb21be
commit
95054dbd52
@ -123,6 +123,10 @@ void PlayerKart::action(KartAction action, int value)
|
||||
//-----------------------------------------------------------------------------
|
||||
void PlayerKart::steer(float dt, int steer_val)
|
||||
{
|
||||
if(user_config->m_gamepad_debug)
|
||||
{
|
||||
printf("steering: steer_val %d ", steer_val);
|
||||
}
|
||||
const float STEER_CHANGE = dt/getTimeFullSteer(); // amount the steering is changed
|
||||
if (steer_val < 0)
|
||||
{
|
||||
@ -153,6 +157,10 @@ void PlayerKart::steer(float dt, int steer_val)
|
||||
if(m_controls.m_steer>0.0f) m_controls.m_steer=0.0f;
|
||||
} // if m_controls.m_steer<=0.0f
|
||||
} // no key is pressed
|
||||
if(user_config->m_gamepad_debug)
|
||||
{
|
||||
printf(" set to: %f\n", m_controls.m_steer);
|
||||
}
|
||||
|
||||
m_controls.m_steer = std::min(1.0f, std::max(-1.0f, m_controls.m_steer));
|
||||
|
||||
|
@ -142,9 +142,9 @@ int handleCmdLine(int argc, char **argv)
|
||||
cmdLineHelp(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
else if(!strcmp(argv[i], "--keyboard-debug"))
|
||||
else if(!strcmp(argv[i], "--gamepad-debug"))
|
||||
{
|
||||
user_config->m_keyboard_debug=true;
|
||||
user_config->m_gamepad_debug=true;
|
||||
}
|
||||
else if(sscanf(argv[i], "--track-debug=%d",&n)==1)
|
||||
{
|
||||
|
@ -517,6 +517,11 @@ void SDLDriver::input()
|
||||
break;
|
||||
|
||||
case SDL_JOYAXISMOTION:
|
||||
if(user_config->m_gamepad_debug)
|
||||
{
|
||||
printf("axis motion: which %d %axis d value %d\n",
|
||||
ev.jaxis.which, ev.jaxis.axis, ev.jaxis.value);
|
||||
}
|
||||
stickIndex = stickInfos[ev.jaxis.which]->m_index;
|
||||
// If the joystick axis exceeds the deadzone report the input.
|
||||
// In menu mode (mode = MENU = 0) the joystick number is reported
|
||||
|
@ -90,7 +90,7 @@ void UserConfig::setDefaults()
|
||||
{
|
||||
setFilename();
|
||||
m_warning = "";
|
||||
m_keyboard_debug = false;
|
||||
m_gamepad_debug = false;
|
||||
m_track_debug = 0;
|
||||
m_bullet_debug = false;
|
||||
m_fullscreen = false;
|
||||
|
@ -158,7 +158,7 @@ public:
|
||||
enum UC_Mode {UC_ENABLE, UC_DISABLE, UC_TEMPORARY_DISABLE};
|
||||
|
||||
// Attributes that are accessed directly.
|
||||
bool m_keyboard_debug;
|
||||
bool m_gamepad_debug;
|
||||
int m_track_debug;
|
||||
bool m_bullet_debug;
|
||||
bool m_fullscreen;
|
||||
|
Loading…
Reference in New Issue
Block a user