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:
parent
581205944a
commit
02ddcc961b
@ -331,8 +331,18 @@ void InputManager::inputSensing(Input::InputType type, int deviceID, int button,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Input::IT_NONE:
|
|
||||||
case Input::IT_STICKHAT:
|
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_MOUSEMOTION:
|
||||||
case Input::IT_MOUSEBUTTON:
|
case Input::IT_MOUSEBUTTON:
|
||||||
// uninteresting (but we keep them here to explicitely state we do
|
// uninteresting (but we keep them here to explicitely state we do
|
||||||
|
@ -292,7 +292,8 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
|
|||||||
const bool keyboard = (m_config->getType() == DEVICE_CONFIG_TYPE_KEYBOARD &&
|
const bool keyboard = (m_config->getType() == DEVICE_CONFIG_TYPE_KEYBOARD &&
|
||||||
sensed_input.m_type == Input::IT_KEYBOARD);
|
sensed_input.m_type == Input::IT_KEYBOARD);
|
||||||
const bool gamepad = (sensed_input.m_type == Input::IT_STICKMOTION ||
|
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;
|
m_config->getType() == DEVICE_CONFIG_TYPE_GAMEPAD;
|
||||||
|
|
||||||
if (keyboard)
|
if (keyboard)
|
||||||
@ -331,6 +332,10 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
|
|||||||
{
|
{
|
||||||
std::cout << "button " << sensed_input.m_button_id<< "\n\n";
|
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
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Sensed unknown gamepad event type??\n";
|
std::cout << "Sensed unknown gamepad event type??\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user