|
@@ -37,7 +37,8 @@ GuiGameListMenuCtrl::GuiGameListMenuCtrl()
|
|
: mSelected(NO_ROW),
|
|
: mSelected(NO_ROW),
|
|
mDebugRender(false),
|
|
mDebugRender(false),
|
|
mHighlighted(NO_ROW),
|
|
mHighlighted(NO_ROW),
|
|
- mCallbackOnInputs(false)
|
|
|
|
|
|
+ mCallbackOnInputs(false),
|
|
|
|
+ mConsumeKeyInputEvents(false)
|
|
{
|
|
{
|
|
VECTOR_SET_ASSOCIATION(mRows);
|
|
VECTOR_SET_ASSOCIATION(mRows);
|
|
|
|
|
|
@@ -818,10 +819,12 @@ bool GuiGameListMenuCtrl::onInputEvent(const InputEventInfo& event)
|
|
{
|
|
{
|
|
if (mCallbackOnInputs)
|
|
if (mCallbackOnInputs)
|
|
{
|
|
{
|
|
- char deviceString[32];
|
|
|
|
- if (!ActionMap::getDeviceName(event.deviceType, event.deviceInst, deviceString))
|
|
|
|
|
|
+ char deviceStr[32];
|
|
|
|
+ if (!ActionMap::getDeviceName(event.deviceType, event.deviceInst, deviceStr))
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
+ String deviceString = deviceStr;
|
|
|
|
+
|
|
if (event.action == SI_MAKE || event.action == SI_BREAK)
|
|
if (event.action == SI_MAKE || event.action == SI_BREAK)
|
|
{
|
|
{
|
|
bool isModifier = false;
|
|
bool isModifier = false;
|
|
@@ -847,12 +850,24 @@ bool GuiGameListMenuCtrl::onInputEvent(const InputEventInfo& event)
|
|
if (!ActionMap::getKeyString(event.objInst, keyString))
|
|
if (!ActionMap::getKeyString(event.objInst, keyString))
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- onInputEvent_callback(deviceString, keyString, state);
|
|
|
|
|
|
+ onInputEvent_callback(deviceString.c_str(), keyString, state);
|
|
|
|
+
|
|
|
|
+ if (mConsumeKeyInputEvents)
|
|
|
|
+ {
|
|
|
|
+ if(deviceString.startsWith("keyboard"))
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
const char* actionString = ActionMap::buildActionString(&event);
|
|
const char* actionString = ActionMap::buildActionString(&event);
|
|
- onInputEvent_callback(deviceString, actionString, state);
|
|
|
|
|
|
+ onInputEvent_callback(deviceString.c_str(), actionString, state);
|
|
|
|
+
|
|
|
|
+ if (mConsumeKeyInputEvents)
|
|
|
|
+ {
|
|
|
|
+ if (deviceString.startsWith("keyboard") || deviceString.startsWith("gamepad"))
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (event.objType == SI_AXIS || event.objType == SI_INT || event.objType == SI_FLOAT)
|
|
else if (event.objType == SI_AXIS || event.objType == SI_INT || event.objType == SI_FLOAT)
|
|
@@ -861,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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1401,6 +1416,10 @@ void GuiGameListMenuCtrl::initPersistFields()
|
|
addField("callbackOnInputs", TypeBool, Offset(mCallbackOnInputs, GuiGameListMenuCtrl),
|
|
addField("callbackOnInputs", TypeBool, Offset(mCallbackOnInputs, GuiGameListMenuCtrl),
|
|
"Script callback when any inputs are detected, even if they aren't the regular 4 face buttons. Useful for secondary/speciality handling of menu navigation.");
|
|
"Script callback when any inputs are detected, even if they aren't the regular 4 face buttons. Useful for secondary/speciality handling of menu navigation.");
|
|
|
|
|
|
|
|
+ addField("consumeKeyInputEvents", TypeBool, Offset(mConsumeKeyInputEvents, GuiGameListMenuCtrl),
|
|
|
|
+ "When callbackOnInputs is active, this indicates if the input event should be consumed, or allowed 'through' to let other things respond to the event as well.");
|
|
|
|
+
|
|
|
|
+
|
|
Parent::initPersistFields();
|
|
Parent::initPersistFields();
|
|
}
|
|
}
|
|
|
|
|