From: <au...@us...> - 2010-11-20 19:10:50
|
Revision: 6666 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6666&view=rev Author: auria Date: 2010-11-20 19:10:43 +0000 (Sat, 20 Nov 2010) Log Message: ----------- Renamed method hasBinding and changed its docs, both were misleading Modified Paths: -------------- main/trunk/src/input/device_manager.cpp main/trunk/src/input/input_device.cpp main/trunk/src/input/input_device.hpp Modified: main/trunk/src/input/device_manager.cpp =================================================================== --- main/trunk/src/input/device_manager.cpp 2010-11-20 15:29:44 UTC (rev 6665) +++ main/trunk/src/input/device_manager.cpp 2010-11-20 19:10:43 UTC (rev 6666) @@ -245,7 +245,7 @@ { KeyboardDevice *keyboard = m_keyboards.get(n); - if (keyboard->hasBinding(btnID, mode, action)) + if (keyboard->processAndMapInput(btnID, mode, action)) { //std::cout << " binding found in keyboard #" << (n+1) << "; action is " << KartActionStrings[*action] << "\n"; if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode @@ -277,7 +277,7 @@ if (gPad != NULL) { - if (gPad->hasBinding(type, btnID, value, mode, gPad->getPlayer(), action)) + if (gPad->processAndMapInput(type, btnID, value, mode, gPad->getPlayer(), action)) { if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode { Modified: main/trunk/src/input/input_device.cpp =================================================================== --- main/trunk/src/input/input_device.cpp 2010-11-20 15:29:44 UTC (rev 6665) +++ main/trunk/src/input/input_device.cpp 2010-11-20 19:10:43 UTC (rev 6666) @@ -46,8 +46,8 @@ // ----------------------------------------------------------------------------- -bool KeyboardDevice::hasBinding(const int id, InputManager::InputDriverMode mode, - PlayerAction* action /* out */) +bool KeyboardDevice::processAndMapInput(const int id, InputManager::InputDriverMode mode, + PlayerAction* action /* out */) { if (mode == InputManager::INGAME) { @@ -142,16 +142,17 @@ // ----------------------------------------------------------------------------- -bool GamePadDevice::hasBinding(Input::InputType type, const int id, const int value, - InputManager::InputDriverMode mode, - StateManager::ActivePlayer* player, PlayerAction* action /* out */) +bool GamePadDevice::processAndMapInput(Input::InputType type, const int id, const int value, + InputManager::InputDriverMode mode, + StateManager::ActivePlayer* player, + PlayerAction* action /* out */) { bool success = false; if(m_prevAxisDirections == NULL) return false; // device not open - if(type == Input::IT_STICKMOTION) + if (type == Input::IT_STICKMOTION) { - if(id >= m_axis_count) return false; // this gamepad doesn't even have that many axes + if (id >= m_axis_count) return false; // this gamepad doesn't even have that many axes if (player != NULL) { @@ -213,11 +214,11 @@ } else { - fprintf(stderr, "hasBinding() called on improperly initialized GamePadDevice\n"); + fprintf(stderr, "processAndMapInput() called on improperly initialized GamePadDevice\n"); abort(); } return success; -} // hasBinding +} // processAndMapInput // ----------------------------------------------------------------------------- Modified: main/trunk/src/input/input_device.hpp =================================================================== --- main/trunk/src/input/input_device.hpp 2010-11-20 15:29:44 UTC (rev 6665) +++ main/trunk/src/input/input_device.hpp 2010-11-20 19:10:43 UTC (rev 6666) @@ -65,7 +65,7 @@ * \param mode Used to determine whether to bind menu actions or game actions * \param[out] action The action associated to this input (only check this value if method returned true) */ - bool hasBinding(const int id, InputManager::InputDriverMode mode, PlayerAction* action); + bool processAndMapInput(const int id, InputManager::InputDriverMode mode, PlayerAction* action); }; @@ -97,17 +97,21 @@ void setButtonPressed(const int i, bool isButtonPressed); /** - * \return Checks if this key belongs to this device. - * If yes, sets action and returns true; otherwise returns false. + * Invoked when this device it used. Verifies if the key/button that was pressed + * is associated with a binding. If yes, sets action and returns true; otherwise returns false. * * \param player Only passed to know where to send 'axis reset's when necessary * \param id ID of the key that was pressed or of the axis that was triggered (depending on * the value of the 'type' parameter) * \param mode Used to determine whether to map menu actions or game actions * \param[out] action The action associated to this input (only check this value if method returned true) + * + * \return Whether the pressed key/button is bound with an action */ - bool hasBinding(Input::InputType type, const int id, const int value, InputManager::InputDriverMode mode, - StateManager::ActivePlayer* player, PlayerAction* action); + bool processAndMapInput(Input::InputType type, const int id, const int value, + InputManager::InputDriverMode mode, + StateManager::ActivePlayer* player, + PlayerAction* action); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |