event.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "platform/input/event.h"
  23. #include "core/module.h"
  24. #include "core/util/journal/process.h"
  25. #include "core/strings/stringFunctions.h"
  26. #include "core/stringTable.h"
  27. #include "platform/platformInput.h"
  28. #include "math/mQuat.h"
  29. MODULE_BEGIN( InputEventManager )
  30. MODULE_INIT_BEFORE( SIM )
  31. MODULE_SHUTDOWN_AFTER( SIM )
  32. MODULE_INIT
  33. {
  34. ManagedSingleton< InputEventManager >::createSingleton();
  35. }
  36. MODULE_SHUTDOWN
  37. {
  38. ManagedSingleton< InputEventManager >::deleteSingleton();
  39. }
  40. MODULE_END;
  41. InputEventManager::InputEventManager()
  42. {
  43. mNextDeviceTypeCode = INPUT_DEVICE_PLUGIN_DEVICES_START;
  44. mNextDeviceCode = INPUT_DEVICE_PLUGIN_CODES_START;
  45. buildVirtualMap();
  46. }
  47. InputEventManager::~InputEventManager()
  48. {
  49. }
  50. U32 InputEventManager::getNextDeviceType()
  51. {
  52. U32 code = mNextDeviceTypeCode;
  53. ++mNextDeviceTypeCode;
  54. return code;
  55. }
  56. U32 InputEventManager::getNextDeviceCode()
  57. {
  58. U32 code = mNextDeviceCode;
  59. ++mNextDeviceCode;
  60. return code;
  61. }
  62. void InputEventManager::registerDevice(IInputDevice* device)
  63. {
  64. // Make sure the device is not already registered
  65. for(U32 i=0; i<mDeviceList.size(); ++i)
  66. {
  67. if(mDeviceList[i] == device)
  68. return;
  69. }
  70. // Add the new device to the list
  71. mDeviceList.push_back(device);
  72. }
  73. void InputEventManager::unregisterDevice(IInputDevice* device)
  74. {
  75. // Remove the device from the list
  76. for(U32 i=0; i<mDeviceList.size(); ++i)
  77. {
  78. if(mDeviceList[i] == device)
  79. {
  80. mDeviceList.erase(i);
  81. return;
  82. }
  83. }
  84. }
  85. bool InputEventManager::isRegisteredDevice(const char* name)
  86. {
  87. for(Vector<IInputDevice*>::iterator itr = mDeviceList.begin(); itr != mDeviceList.end(); ++itr)
  88. {
  89. if((*itr)->isEnabled())
  90. {
  91. const char* deviceName = (*itr)->getDeviceName();
  92. if(dStrnicmp(name, deviceName, dStrlen(deviceName)) == 0)
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. bool InputEventManager::isRegisteredDevice(U32 type)
  101. {
  102. for(Vector<IInputDevice*>::iterator itr = mDeviceList.begin(); itr != mDeviceList.end(); ++itr)
  103. {
  104. if((*itr)->isEnabled())
  105. {
  106. U32 deviceType = (*itr)->getDeviceType();
  107. if(deviceType == type)
  108. {
  109. return true;
  110. }
  111. }
  112. }
  113. return false;
  114. }
  115. bool InputEventManager::isRegisteredDeviceWithAttributes(const char* name, U32& deviceType, U32&nameLen)
  116. {
  117. for(Vector<IInputDevice*>::iterator itr = mDeviceList.begin(); itr != mDeviceList.end(); ++itr)
  118. {
  119. if((*itr)->isEnabled())
  120. {
  121. const char* deviceName = (*itr)->getDeviceName();
  122. S32 length = dStrlen(deviceName);
  123. if(dStrnicmp(name, deviceName, length) == 0)
  124. {
  125. deviceType = (*itr)->getDeviceType();
  126. nameLen = length;
  127. return true;
  128. }
  129. }
  130. }
  131. return false;
  132. }
  133. const char* InputEventManager::getRegisteredDeviceName(U32 type)
  134. {
  135. for(Vector<IInputDevice*>::iterator itr = mDeviceList.begin(); itr != mDeviceList.end(); ++itr)
  136. {
  137. if((*itr)->isEnabled())
  138. {
  139. U32 deviceType = (*itr)->getDeviceType();
  140. if(deviceType == type)
  141. {
  142. return (*itr)->getDeviceName();
  143. }
  144. }
  145. }
  146. return NULL;
  147. }
  148. void InputEventManager::start()
  149. {
  150. Process::notify(this, &InputEventManager::process, PROCESS_INPUT_ORDER);
  151. }
  152. void InputEventManager::stop()
  153. {
  154. Process::remove(this, &InputEventManager::process);
  155. }
  156. void InputEventManager::process()
  157. {
  158. // Process each device
  159. for(Vector<IInputDevice*>::iterator itr = mDeviceList.begin(); itr != mDeviceList.end(); ++itr)
  160. {
  161. if((*itr)->isEnabled())
  162. {
  163. (*itr)->process();
  164. }
  165. }
  166. }
  167. // Used for the old virtual map table that was originally in actionMap.cpp
  168. struct CodeMapping
  169. {
  170. const char* pDescription;
  171. InputEventType type;
  172. InputObjectInstances code;
  173. };
  174. CodeMapping gVirtualMap[] =
  175. {
  176. //-------------------------------------- KEYBOARD EVENTS
  177. //
  178. { "backspace", SI_KEY, KEY_BACKSPACE },
  179. { "tab", SI_KEY, KEY_TAB },
  180. { "return", SI_KEY, KEY_RETURN },
  181. { "enter", SI_KEY, KEY_RETURN },
  182. { "shift", SI_KEY, KEY_SHIFT },
  183. { "ctrl", SI_KEY, KEY_CONTROL },
  184. { "alt", SI_KEY, KEY_ALT },
  185. { "pause", SI_KEY, KEY_PAUSE },
  186. { "capslock", SI_KEY, KEY_CAPSLOCK },
  187. { "escape", SI_KEY, KEY_ESCAPE },
  188. { "space", SI_KEY, KEY_SPACE },
  189. { "pagedown", SI_KEY, KEY_PAGE_DOWN },
  190. { "pageup", SI_KEY, KEY_PAGE_UP },
  191. { "end", SI_KEY, KEY_END },
  192. { "home", SI_KEY, KEY_HOME },
  193. { "left", SI_KEY, KEY_LEFT },
  194. { "up", SI_KEY, KEY_UP },
  195. { "right", SI_KEY, KEY_RIGHT },
  196. { "down", SI_KEY, KEY_DOWN },
  197. { "print", SI_KEY, KEY_PRINT },
  198. { "insert", SI_KEY, KEY_INSERT },
  199. { "delete", SI_KEY, KEY_DELETE },
  200. { "help", SI_KEY, KEY_HELP },
  201. { "win_lwindow", SI_KEY, KEY_WIN_LWINDOW },
  202. { "win_rwindow", SI_KEY, KEY_WIN_RWINDOW },
  203. { "win_apps", SI_KEY, KEY_WIN_APPS },
  204. { "cmd", SI_KEY, KEY_ALT },
  205. { "opt", SI_KEY, KEY_MAC_OPT },
  206. { "lopt", SI_KEY, KEY_MAC_LOPT },
  207. { "ropt", SI_KEY, KEY_MAC_ROPT },
  208. { "numpad0", SI_KEY, KEY_NUMPAD0 },
  209. { "numpad1", SI_KEY, KEY_NUMPAD1 },
  210. { "numpad2", SI_KEY, KEY_NUMPAD2 },
  211. { "numpad3", SI_KEY, KEY_NUMPAD3 },
  212. { "numpad4", SI_KEY, KEY_NUMPAD4 },
  213. { "numpad5", SI_KEY, KEY_NUMPAD5 },
  214. { "numpad6", SI_KEY, KEY_NUMPAD6 },
  215. { "numpad7", SI_KEY, KEY_NUMPAD7 },
  216. { "numpad8", SI_KEY, KEY_NUMPAD8 },
  217. { "numpad9", SI_KEY, KEY_NUMPAD9 },
  218. { "numpadmult", SI_KEY, KEY_MULTIPLY },
  219. { "numpadadd", SI_KEY, KEY_ADD },
  220. { "numpadsep", SI_KEY, KEY_SEPARATOR },
  221. { "numpadminus", SI_KEY, KEY_SUBTRACT },
  222. { "numpaddecimal", SI_KEY, KEY_DECIMAL },
  223. { "numpaddivide", SI_KEY, KEY_DIVIDE },
  224. { "numpadenter", SI_KEY, KEY_NUMPADENTER },
  225. { "f1", SI_KEY, KEY_F1 },
  226. { "f2", SI_KEY, KEY_F2 },
  227. { "f3", SI_KEY, KEY_F3 },
  228. { "f4", SI_KEY, KEY_F4 },
  229. { "f5", SI_KEY, KEY_F5 },
  230. { "f6", SI_KEY, KEY_F6 },
  231. { "f7", SI_KEY, KEY_F7 },
  232. { "f8", SI_KEY, KEY_F8 },
  233. { "f9", SI_KEY, KEY_F9 },
  234. { "f10", SI_KEY, KEY_F10 },
  235. { "f11", SI_KEY, KEY_F11 },
  236. { "f12", SI_KEY, KEY_F12 },
  237. { "f13", SI_KEY, KEY_F13 },
  238. { "f14", SI_KEY, KEY_F14 },
  239. { "f15", SI_KEY, KEY_F15 },
  240. { "f16", SI_KEY, KEY_F16 },
  241. { "f17", SI_KEY, KEY_F17 },
  242. { "f18", SI_KEY, KEY_F18 },
  243. { "f19", SI_KEY, KEY_F19 },
  244. { "f20", SI_KEY, KEY_F20 },
  245. { "f21", SI_KEY, KEY_F21 },
  246. { "f22", SI_KEY, KEY_F22 },
  247. { "f23", SI_KEY, KEY_F23 },
  248. { "f24", SI_KEY, KEY_F24 },
  249. { "numlock", SI_KEY, KEY_NUMLOCK },
  250. { "scrolllock", SI_KEY, KEY_SCROLLLOCK },
  251. { "lshift", SI_KEY, KEY_LSHIFT },
  252. { "rshift", SI_KEY, KEY_RSHIFT },
  253. { "lcontrol", SI_KEY, KEY_LCONTROL },
  254. { "rcontrol", SI_KEY, KEY_RCONTROL },
  255. { "lalt", SI_KEY, KEY_LALT },
  256. { "ralt", SI_KEY, KEY_RALT },
  257. { "tilde", SI_KEY, KEY_TILDE },
  258. { "minus", SI_KEY, KEY_MINUS },
  259. { "equals", SI_KEY, KEY_EQUALS },
  260. { "lbracket", SI_KEY, KEY_LBRACKET },
  261. { "rbracket", SI_KEY, KEY_RBRACKET },
  262. { "backslash", SI_KEY, KEY_BACKSLASH },
  263. { "semicolon", SI_KEY, KEY_SEMICOLON },
  264. { "apostrophe", SI_KEY, KEY_APOSTROPHE },
  265. { "comma", SI_KEY, KEY_COMMA },
  266. { "period", SI_KEY, KEY_PERIOD },
  267. { "slash", SI_KEY, KEY_SLASH },
  268. { "lessthan", SI_KEY, KEY_OEM_102 },
  269. //-------------------------------------- BUTTON EVENTS
  270. // Joystick/Mouse buttons
  271. { "button0", SI_BUTTON, KEY_BUTTON0 },
  272. { "button1", SI_BUTTON, KEY_BUTTON1 },
  273. { "button2", SI_BUTTON, KEY_BUTTON2 },
  274. { "button3", SI_BUTTON, KEY_BUTTON3 },
  275. { "button4", SI_BUTTON, KEY_BUTTON4 },
  276. { "button5", SI_BUTTON, KEY_BUTTON5 },
  277. { "button6", SI_BUTTON, KEY_BUTTON6 },
  278. { "button7", SI_BUTTON, KEY_BUTTON7 },
  279. { "button8", SI_BUTTON, KEY_BUTTON8 },
  280. { "button9", SI_BUTTON, KEY_BUTTON9 },
  281. { "button10", SI_BUTTON, KEY_BUTTON10 },
  282. { "button11", SI_BUTTON, KEY_BUTTON11 },
  283. { "button12", SI_BUTTON, KEY_BUTTON12 },
  284. { "button13", SI_BUTTON, KEY_BUTTON13 },
  285. { "button14", SI_BUTTON, KEY_BUTTON14 },
  286. { "button15", SI_BUTTON, KEY_BUTTON15 },
  287. { "button16", SI_BUTTON, KEY_BUTTON16 },
  288. { "button17", SI_BUTTON, KEY_BUTTON17 },
  289. { "button18", SI_BUTTON, KEY_BUTTON18 },
  290. { "button19", SI_BUTTON, KEY_BUTTON19 },
  291. { "button20", SI_BUTTON, KEY_BUTTON20 },
  292. { "button21", SI_BUTTON, KEY_BUTTON21 },
  293. { "button22", SI_BUTTON, KEY_BUTTON22 },
  294. { "button23", SI_BUTTON, KEY_BUTTON23 },
  295. { "button24", SI_BUTTON, KEY_BUTTON24 },
  296. { "button25", SI_BUTTON, KEY_BUTTON25 },
  297. { "button26", SI_BUTTON, KEY_BUTTON26 },
  298. { "button27", SI_BUTTON, KEY_BUTTON27 },
  299. { "button28", SI_BUTTON, KEY_BUTTON28 },
  300. { "button29", SI_BUTTON, KEY_BUTTON29 },
  301. { "button30", SI_BUTTON, KEY_BUTTON30 },
  302. { "button31", SI_BUTTON, KEY_BUTTON31 },
  303. { "button32", SI_BUTTON, KEY_BUTTON32 },
  304. { "button33", SI_BUTTON, KEY_BUTTON33 },
  305. { "button34", SI_BUTTON, KEY_BUTTON34 },
  306. { "button35", SI_BUTTON, KEY_BUTTON35 },
  307. { "button36", SI_BUTTON, KEY_BUTTON36 },
  308. { "button37", SI_BUTTON, KEY_BUTTON37 },
  309. { "button38", SI_BUTTON, KEY_BUTTON38 },
  310. { "button39", SI_BUTTON, KEY_BUTTON39 },
  311. { "button40", SI_BUTTON, KEY_BUTTON40 },
  312. { "button41", SI_BUTTON, KEY_BUTTON41 },
  313. { "button42", SI_BUTTON, KEY_BUTTON42 },
  314. { "button43", SI_BUTTON, KEY_BUTTON43 },
  315. { "button44", SI_BUTTON, KEY_BUTTON44 },
  316. { "button45", SI_BUTTON, KEY_BUTTON45 },
  317. { "button46", SI_BUTTON, KEY_BUTTON46 },
  318. { "button47", SI_BUTTON, KEY_BUTTON47 },
  319. //-------------------------------------- MOVE EVENTS
  320. // Mouse/Joystick axes:
  321. { "xaxis", SI_AXIS, SI_XAXIS },
  322. { "yaxis", SI_AXIS, SI_YAXIS },
  323. { "zaxis", SI_AXIS, SI_ZAXIS },
  324. { "rxaxis", SI_AXIS, SI_RXAXIS },
  325. { "ryaxis", SI_AXIS, SI_RYAXIS },
  326. { "rzaxis", SI_AXIS, SI_RZAXIS },
  327. { "slider", SI_AXIS, SI_SLIDER },
  328. //-------------------------------------- POV EVENTS
  329. // Joystick POV:
  330. { "xpov", SI_POV, SI_XPOV },
  331. { "ypov", SI_POV, SI_YPOV },
  332. { "upov", SI_POV, SI_UPOV },
  333. { "dpov", SI_POV, SI_DPOV },
  334. { "lpov", SI_POV, SI_LPOV },
  335. { "rpov", SI_POV, SI_RPOV },
  336. { "xpov2", SI_POV, SI_XPOV2 },
  337. { "ypov2", SI_POV, SI_YPOV2 },
  338. { "upov2", SI_POV, SI_UPOV2 },
  339. { "dpov2", SI_POV, SI_DPOV2 },
  340. { "lpov2", SI_POV, SI_LPOV2 },
  341. { "rpov2", SI_POV, SI_RPOV2 },
  342. #if defined( TORQUE_OS_WIN ) || defined( TORQUE_OS_XENON )
  343. //-------------------------------------- XINPUT EVENTS
  344. // Controller connect / disconnect:
  345. { "connect", SI_BUTTON, XI_CONNECT },
  346. // L & R Thumbsticks:
  347. { "thumblx", SI_AXIS, XI_THUMBLX },
  348. { "thumbly", SI_AXIS, XI_THUMBLY },
  349. { "thumbrx", SI_AXIS, XI_THUMBRX },
  350. { "thumbry", SI_AXIS, XI_THUMBRY },
  351. // L & R Triggers:
  352. { "triggerl", SI_AXIS, XI_LEFT_TRIGGER },
  353. { "triggerr", SI_AXIS, XI_RIGHT_TRIGGER },
  354. // DPAD Buttons:
  355. { "dpadu", SI_BUTTON, SI_UPOV },
  356. { "dpadd", SI_BUTTON, SI_DPOV },
  357. { "dpadl", SI_BUTTON, SI_LPOV },
  358. { "dpadr", SI_BUTTON, SI_RPOV },
  359. // START & BACK Buttons:
  360. { "btn_start", SI_BUTTON, XI_START },
  361. { "btn_back", SI_BUTTON, XI_BACK },
  362. // L & R Thumbstick Buttons:
  363. { "btn_lt", SI_BUTTON, XI_LEFT_THUMB },
  364. { "btn_rt", SI_BUTTON, XI_RIGHT_THUMB },
  365. // L & R Shoulder Buttons:
  366. { "btn_l", SI_BUTTON, XI_LEFT_SHOULDER },
  367. { "btn_r", SI_BUTTON, XI_RIGHT_SHOULDER },
  368. // Primary buttons:
  369. { "btn_a", SI_BUTTON, XI_A },
  370. { "btn_b", SI_BUTTON, XI_B },
  371. { "btn_x", SI_BUTTON, XI_X },
  372. { "btn_y", SI_BUTTON, XI_Y },
  373. #endif
  374. //-------------------------------------- MISCELLANEOUS EVENTS
  375. //
  376. { "anykey", SI_KEY, KEY_ANYKEY },
  377. { "nomatch", SI_UNKNOWN, (InputObjectInstances)0xFFFFFFFF }
  378. };
  379. void InputEventManager::buildVirtualMap()
  380. {
  381. char desc[256];
  382. VirtualMapData* data;
  383. for (U32 j = 0; gVirtualMap[j].code != 0xFFFFFFFF; j++)
  384. {
  385. // Make sure the description is lower case
  386. desc[0] = 0;
  387. dStrncpy(desc, gVirtualMap[j].pDescription, 255);
  388. dStrlwr(desc);
  389. data = new VirtualMapData();
  390. data->type = gVirtualMap[j].type;
  391. data->code = gVirtualMap[j].code;
  392. data->desc = StringTable->insert(desc);
  393. mVirtualMap.insert(data, desc);
  394. mActionCodeMap.insertUnique(data->code, *data);
  395. }
  396. }
  397. void InputEventManager::addVirtualMap(const char* description, InputEventType type, InputObjectInstances code)
  398. {
  399. // Make sure the description is lower case
  400. char desc[256];
  401. desc[0] = 0;
  402. dStrncpy(desc, description, 255);
  403. dStrlwr(desc);
  404. VirtualMapData* data = new VirtualMapData();
  405. data->type = type;
  406. data->code = code;
  407. data->desc = StringTable->insert(desc);
  408. mVirtualMap.insert(data, desc);
  409. mActionCodeMap.insertUnique(data->code, *data);
  410. }
  411. InputEventManager::VirtualMapData* InputEventManager::findVirtualMap(const char* description)
  412. {
  413. char desc[256];
  414. desc[0] = 0;
  415. dStrncpy(desc, description, 255);
  416. dStrlwr(desc);
  417. return mVirtualMap.retreive(desc);
  418. }
  419. const char* InputEventManager::findVirtualMapDescFromCode(U32 code)
  420. {
  421. HashTable<U32, VirtualMapData>::Iterator itr = mActionCodeMap.find(code);
  422. if(itr != mActionCodeMap.end())
  423. return itr->value.desc;
  424. return NULL;
  425. }
  426. void InputEventManager::buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, S32 iValue)
  427. {
  428. InputEventInfo newEvent;
  429. newEvent.deviceType = deviceType;
  430. newEvent.deviceInst = deviceInst;
  431. newEvent.objType = objType;
  432. newEvent.objInst = objInst;
  433. newEvent.action = action;
  434. newEvent.iValue = iValue;
  435. newEvent.postToSignal(Input::smInputEvent);
  436. }
  437. void InputEventManager::buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, F32 fValue)
  438. {
  439. InputEventInfo newEvent;
  440. newEvent.deviceType = deviceType;
  441. newEvent.deviceInst = deviceInst;
  442. newEvent.objType = objType;
  443. newEvent.objInst = objInst;
  444. newEvent.action = action;
  445. newEvent.fValue = fValue;
  446. newEvent.postToSignal(Input::smInputEvent);
  447. }
  448. void InputEventManager::buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, Point3F& pValue)
  449. {
  450. InputEventInfo newEvent;
  451. newEvent.deviceType = deviceType;
  452. newEvent.deviceInst = deviceInst;
  453. newEvent.objType = objType;
  454. newEvent.objInst = objInst;
  455. newEvent.action = action;
  456. newEvent.fValue = pValue.x;
  457. newEvent.fValue2 = pValue.y;
  458. newEvent.fValue3 = pValue.z;
  459. newEvent.postToSignal(Input::smInputEvent);
  460. }
  461. void InputEventManager::buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, QuatF& qValue)
  462. {
  463. InputEventInfo newEvent;
  464. newEvent.deviceType = deviceType;
  465. newEvent.deviceInst = deviceInst;
  466. newEvent.objType = objType;
  467. newEvent.objInst = objInst;
  468. newEvent.action = action;
  469. newEvent.fValue = qValue.x;
  470. newEvent.fValue2 = qValue.y;
  471. newEvent.fValue3 = qValue.z;
  472. newEvent.fValue4 = qValue.w;
  473. newEvent.postToSignal(Input::smInputEvent);
  474. }