Highlight gamepad when pressing its keys, to help the player tell them apart

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8683 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-05-23 20:51:17 +00:00
parent da6742d7b1
commit 30435bbde4
4 changed files with 28 additions and 16 deletions

View File

@ -272,6 +272,15 @@ namespace GUIEngine
virtual EventPropagation filterActions(PlayerAction action, int deviceID, const unsigned int value,
Input::InputType type, int playerId) { return EVENT_LET; }
/**
* \brief override this if you need to be notified of raw input in subclasses
*/
virtual void filterInput(Input::InputType type,
int deviceID,
int btnID,
int axisDir,
int value) {}
};
}

View File

@ -348,6 +348,11 @@ bool DeviceManager::translateInput( Input::InputType type,
StateManager::ActivePlayer** player /* out */,
PlayerAction* action /* out */ )
{
if (GUIEngine::getCurrentScreen() != NULL)
{
GUIEngine::getCurrentScreen()->filterInput(type, deviceID, btnID, axisDir, value);
}
InputDevice *device = NULL;
// If the input event matches a bind on an input device, get a pointer to the device

View File

@ -246,12 +246,13 @@ void OptionsScreenInput::unloaded()
// -----------------------------------------------------------------------------
EventPropagation OptionsScreenInput::filterActions(PlayerAction action, int deviceID,
const unsigned int value,
Input::InputType type, int playerId)
void OptionsScreenInput::filterInput(Input::InputType type,
int deviceID,
int btnID,
int axisDir,
int value)
{
/*
if (value > Input::MAX_VALUE*2/3 && (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON))
if (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON)
{
GamePadDevice* gamepad = input_manager->getDeviceList()->getGamePadFromIrrID(deviceID);
if (gamepad != NULL && gamepad->getConfiguration() != NULL)
@ -283,15 +284,12 @@ EventPropagation OptionsScreenInput::filterActions(PlayerAction action, int devi
}
}
}
*/
return EVENT_LET;
}
// -----------------------------------------------------------------------------
void OptionsScreenInput::onUpdate(float dt, irr::video::IVideoDriver* drv)
{
/*
std::map<std::string, float>::iterator it;
for (it = m_highlights.begin(); it != m_highlights.end();)
{
@ -310,6 +308,5 @@ void OptionsScreenInput::onUpdate(float dt, irr::video::IVideoDriver* drv)
it++;
}
}
*/
//m_highlights[internal_name]
}

View File

@ -42,7 +42,7 @@ class OptionsScreenInput : public GUIEngine::Screen, public GUIEngine::ScreenSin
irr::gui::STKModifiedSpriteBank* m_icon_bank;
// std::map<std::string, float> m_highlights;
std::map<std::string, float> m_highlights;
public:
friend class GUIEngine::ScreenSingleton<OptionsScreenInput>;
@ -65,13 +65,14 @@ public:
*/
void rebuildDeviceList();
/** \brief Override callback from base class */
virtual GUIEngine::EventPropagation filterActions(PlayerAction action,
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void filterInput(Input::InputType type,
int deviceID,
const unsigned int value,
Input::InputType type,
int playerId);
int btnID,
int axisDir,
int value);
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void onUpdate(float dt, irr::video::IVideoDriver* drv);
};