mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Added handling for gamepad key input consumption as well.
This commit is contained in:
parent
bca972ae24
commit
efa84660bc
1 changed files with 9 additions and 10 deletions
|
|
@ -819,11 +819,11 @@ bool GuiGameListMenuCtrl::onInputEvent(const InputEventInfo& event)
|
||||||
{
|
{
|
||||||
if (mCallbackOnInputs)
|
if (mCallbackOnInputs)
|
||||||
{
|
{
|
||||||
char deviceString[32];
|
char deviceStr[32];
|
||||||
if (!ActionMap::getDeviceName(event.deviceType, event.deviceInst, deviceString))
|
if (!ActionMap::getDeviceName(event.deviceType, event.deviceInst, deviceStr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StringTableEntry deviceStringEntry = StringTable->insert(deviceString);
|
String deviceString = deviceStr;
|
||||||
|
|
||||||
if (event.action == SI_MAKE || event.action == SI_BREAK)
|
if (event.action == SI_MAKE || event.action == SI_BREAK)
|
||||||
{
|
{
|
||||||
|
|
@ -850,23 +850,22 @@ bool GuiGameListMenuCtrl::onInputEvent(const InputEventInfo& event)
|
||||||
if (!ActionMap::getKeyString(event.objInst, keyString))
|
if (!ActionMap::getKeyString(event.objInst, keyString))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
onInputEvent_callback(deviceStringEntry, keyString, state);
|
onInputEvent_callback(deviceString.c_str(), keyString, state);
|
||||||
|
|
||||||
if (mConsumeKeyInputEvents)
|
if (mConsumeKeyInputEvents)
|
||||||
{
|
{
|
||||||
if(deviceStringEntry == StringTable->insert("keyboard"))
|
if(deviceString.startsWith("keyboard"))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char* actionString = ActionMap::buildActionString(&event);
|
const char* actionString = ActionMap::buildActionString(&event);
|
||||||
onInputEvent_callback(deviceStringEntry, actionString, state);
|
onInputEvent_callback(deviceString.c_str(), actionString, state);
|
||||||
|
|
||||||
if (mConsumeKeyInputEvents)
|
if (mConsumeKeyInputEvents)
|
||||||
{
|
{
|
||||||
if (deviceStringEntry == StringTable->insert("keyboard"))
|
if (deviceString.startsWith("keyboard") || deviceString.startsWith("gamepad"))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -877,12 +876,12 @@ bool GuiGameListMenuCtrl::onInputEvent(const InputEventInfo& event)
|
||||||
if (event.objType == SI_INT)
|
if (event.objType == SI_INT)
|
||||||
fValue = (F32)event.iValue;
|
fValue = (F32)event.iValue;
|
||||||
|
|
||||||
if (!ActionMap::getDeviceName(event.deviceType, event.deviceInst, deviceString))
|
if (!ActionMap::getDeviceName(event.deviceType, event.deviceInst, deviceStr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const char* actionString = ActionMap::buildActionString(&event);
|
const char* actionString = ActionMap::buildActionString(&event);
|
||||||
|
|
||||||
onAxisEvent_callback(deviceString, actionString, fValue);
|
onAxisEvent_callback(deviceStr, actionString, fValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue