Blindly trying to add hat support (I don't have hats so can't test)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8085 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-03-27 02:03:46 +00:00
parent 581205944a
commit 02ddcc961b
2 changed files with 17 additions and 2 deletions

View File

@ -331,8 +331,18 @@ void InputManager::inputSensing(Input::InputType type, int deviceID, int button,
break;
}
case Input::IT_NONE:
case Input::IT_STICKHAT:
if (value > Input::MAX_VALUE/2)
{
Input sensed_input;
sensed_input.m_type = Input::IT_STICKHAT;
sensed_input.m_device_id = deviceID;
sensed_input.m_button_id = button;
sensed_input.m_character = deviceID;
OptionsScreenInput2::getInstance()->gotSensedInput(sensed_input);
break;
}
case Input::IT_NONE:
case Input::IT_MOUSEMOTION:
case Input::IT_MOUSEBUTTON:
// uninteresting (but we keep them here to explicitely state we do

View File

@ -292,7 +292,8 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
const bool keyboard = (m_config->getType() == DEVICE_CONFIG_TYPE_KEYBOARD &&
sensed_input.m_type == Input::IT_KEYBOARD);
const bool gamepad = (sensed_input.m_type == Input::IT_STICKMOTION ||
sensed_input.m_type == Input::IT_STICKBUTTON) &&
sensed_input.m_type == Input::IT_STICKBUTTON ||
sensed_input.m_type == Input::IT_STICKHAT) &&
m_config->getType() == DEVICE_CONFIG_TYPE_GAMEPAD;
if (keyboard)
@ -331,6 +332,10 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
{
std::cout << "button " << sensed_input.m_button_id<< "\n\n";
}
else if (sensed_input.m_type == Input::IT_STICKHAT)
{
std::cout << "Hat " << sensed_input.m_button_id << "\n\n";
}
else
{
std::cout << "Sensed unknown gamepad event type??\n";