소스 검색

Added handling for gamepad key input consumption as well.

Areloch 4 년 전
부모
커밋
efa84660bc
1개의 변경된 파일9개의 추가작업 그리고 10개의 파일을 삭제
  1. 9 10
      Engine/source/gui/controls/guiGameListMenuCtrl.cpp

+ 9 - 10
Engine/source/gui/controls/guiGameListMenuCtrl.cpp

@@ -819,11 +819,11 @@ 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;
 
 
-      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);
       }
       }
    }
    }