Added --wiimote-debug command line option to print raw values read

from a wiimote.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12773 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-05-16 06:50:41 +00:00
parent 879e0248aa
commit 6d097b6ad5
3 changed files with 30 additions and 19 deletions

View File

@ -426,6 +426,10 @@ namespace UserConfigParams
/** If gamepad debugging is enabled. */
PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
/** Wiimote debugging. */
PARAM_PREFIX bool m_wiimote_debug PARAM_DEFAULT( false );
/** Debug gamepads by visualising their values. */
PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false );
/** If material debugging (printing terrain specific slowdown)

View File

@ -162,17 +162,16 @@ void Wiimote::updateIrrEvent()
// Simulate an Irrlicht joystick event
resetIrrEvent(&m_irr_event, wiimoteIdToIrrId(m_wiimote_id));
#ifdef DEBUG
if(UserConfigParams::m_wiimote_debug)
{
Log::verbose("wiimote", "pitch: %f yaw %f roll %f",
m_wiimote_handle->orient.pitch,
m_wiimote_handle->orient.yaw,
m_wiimote_handle->orient.roll);
}
#endif
// --------------------- Wiimote accelerometers --------------------
//printf("yaw: %f\n", m_wiimote_handle->orient.yaw);
//printf("pitch: %f\n", m_wiimote_handle->orient.pitch);
//printf("roll: %f\n", m_wiimote_handle->orient.roll);
// --- Linear response version ---
//const float wiimote_to_joystick = -JOYSTICK_ABS_MAX_ANGLE / float(UserConfigParams::m_wiimote_max);
//const float angle = wiimote_to_joystick * m_wiimote_handle->orient.pitch;
// --- Quadratic response version ---
float normalized_angle = -m_wiimote_handle->orient.pitch / UserConfigParams::m_wiimote_max;
if(normalized_angle<-1.0f)
normalized_angle = -1.0f;
@ -202,10 +201,13 @@ void Wiimote::updateIrrEvent()
{
if(IS_PRESSED(m_wiimote_handle, wiimote_actions[i].wiimote_action_id))
{
//printf("wiimote %d: pressed button %s -> button id: %d\n",
// m_wiimote_id,
// wiimote_actions[i].wiimote_action_name,
// wiimote_actions[i].button_id);
#ifdef DEBUG
if(UserConfigParams::m_wiimote_debug)
Log::verbose("wiimote", "%d: pressed button %s -> button id: %d\n",
m_wiimote_id,
wiimote_actions[i].wiimote_action_name,
wiimote_actions[i].button_id);
#endif
m_irr_event.JoystickEvent.ButtonStates |= (1<<(wiimote_actions[i].button_id));
}
}
@ -266,7 +268,8 @@ WiimoteManager::~WiimoteManager()
// -----------------------------------------------------------------------------
/**
* Launch wiimote detection and add the corresponding gamepad devices to the device manager
* Launch wiimote detection and add the corresponding gamepad devices to the
* device manager.
* TODO: this should be done in a separate thread, to not block the UI...
*/
void WiimoteManager::launchDetection(int timeout)

View File

@ -622,6 +622,10 @@ int handleCmdLine(int argc, char **argv)
{
UserConfigParams::m_gamepad_debug=true;
}
else if (!strcmp(argv[i], "--wiimote-debug"))
{
UserConfigParams::m_wiimote_debug = true;
}
else if (!strcmp(argv[i], "--tutorial-debug"))
{
UserConfigParams::m_tutorial_debug = true;