diff --git a/src/guiengine/screen.hpp b/src/guiengine/screen.hpp index 1326a6b89..45c94a768 100644 --- a/src/guiengine/screen.hpp +++ b/src/guiengine/screen.hpp @@ -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) {} + }; } diff --git a/src/input/device_manager.cpp b/src/input/device_manager.cpp index 2fd18f74a..2215f6cd4 100644 --- a/src/input/device_manager.cpp +++ b/src/input/device_manager.cpp @@ -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 diff --git a/src/states_screens/options_screen_input.cpp b/src/states_screens/options_screen_input.cpp index bb7bbb84a..24f93db19 100644 --- a/src/states_screens/options_screen_input.cpp +++ b/src/states_screens/options_screen_input.cpp @@ -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::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] } diff --git a/src/states_screens/options_screen_input.hpp b/src/states_screens/options_screen_input.hpp index 0f7a03806..c6ce5c385 100644 --- a/src/states_screens/options_screen_input.hpp +++ b/src/states_screens/options_screen_input.hpp @@ -42,7 +42,7 @@ class OptionsScreenInput : public GUIEngine::Screen, public GUIEngine::ScreenSin irr::gui::STKModifiedSpriteBank* m_icon_bank; - // std::map m_highlights; + std::map m_highlights; public: friend class GUIEngine::ScreenSingleton; @@ -65,13 +65,14 @@ public: */ void rebuildDeviceList(); - /** \brief Override callback from base class */ - virtual GUIEngine::EventPropagation filterActions(PlayerAction action, - int deviceID, - const unsigned int value, - Input::InputType type, - int playerId); + /** \brief implement callback from parent class GUIEngine::Screen */ + virtual void filterInput(Input::InputType type, + int deviceID, + int btnID, + int axisDir, + int value); + /** \brief implement callback from parent class GUIEngine::Screen */ virtual void onUpdate(float dt, irr::video::IVideoDriver* drv); };