From: <au...@us...> - 2009-12-06 16:23:25
|
Revision: 4254 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4254&view=rev Author: auria Date: 2009-12-06 16:23:17 +0000 (Sun, 06 Dec 2009) Log Message: ----------- Fixed input device association bug when starting game clicking and a gamepad is plugged Modified Paths: -------------- main/branches/irrlicht/src/input/device_manager.cpp Modified: main/branches/irrlicht/src/input/device_manager.cpp =================================================================== --- main/branches/irrlicht/src/input/device_manager.cpp 2009-12-06 16:06:39 UTC (rev 4253) +++ main/branches/irrlicht/src/input/device_manager.cpp 2009-12-06 16:23:17 UTC (rev 4254) @@ -246,7 +246,13 @@ }; // Return true if input was successfully translated to an action and player - if (device != NULL) m_latest_used_device = device; + if (device != NULL && abs(value) > Input::MAX_VALUE/2) + { + //std::cout<< "========== Setting latest device " << (device->getType() == DT_KEYBOARD ? "keyboard" : "gamepad") + // << " #" << deviceID << " button=" << btnID << " value=" << value << " ==========\n"; + + m_latest_used_device = device; + } return (device != NULL); } //----------------------------------------------------------------------------- @@ -254,8 +260,9 @@ { // If none, probably the user clicked or used enter; give keyboard by default - if (m_latest_used_device == NULL ) - { + if (m_latest_used_device == NULL) + { + std::cout<< "========== No latest device, returning keyboard ==========\n"; return m_keyboards.get(0); // FIXME: is this right? } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |