void OptionsScreenInput::filterInput(Input::InputType type, int deviceID, int btnID, int axisDir, int axisRange, int value) { if (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON) { GamePadDevice* gamepad = input_manager->getDeviceList()->getGamePadFromIrrID(deviceID); if (gamepad != NULL && gamepad->getConfiguration() != NULL) { //printf("'%s'\n", gamepad->getConfiguration()->getName().c_str()); ListWidget* devices = this->getWidget<ListWidget>("devices"); assert(devices != NULL); std::string internal_name; const int gpad_config_count = input_manager->getDeviceList()->getGamePadConfigAmount(); for (int i = 0; i < gpad_config_count; i++) { GamepadConfig *config = input_manager->getDeviceList()->getGamepadConfig(i); // Don't display the configuration if a matching device is not available if (config == gamepad->getConfiguration()) { std::ostringstream gpname; gpname << "gamepad" << i; internal_name = gpname.str(); } } if (internal_name.size() > 0 && abs(value) > Input::MAX_VALUE/2) { devices->markItemRed(internal_name.c_str()); m_highlights[internal_name] = 0.25f; } } } }
void OptionsScreenInput::onUpdate(float dt) { std::map<std::string, float>::iterator it; for (it = m_highlights.begin(); it != m_highlights.end();) { it->second -= dt; if (it->second < 0.0f) { ListWidget* devices = this->getWidget<ListWidget>("devices"); assert(devices != NULL); devices->markItemRed(it->first.c_str(), false); m_highlights.erase(it++); } else { it++; } } //m_highlights[internal_name] } // onUpdate