| 1436 | } |
| 1437 | |
| 1438 | void PhysXSample::registerInputEvents(bool ignoreSaved) |
| 1439 | { |
| 1440 | const char* sampleName = mApplication.mRunning->getName(); |
| 1441 | |
| 1442 | SampleUserInput* sampleUserInput = mApplication.getPlatform()->getSampleUserInput(); |
| 1443 | if(!sampleUserInput) |
| 1444 | return; |
| 1445 | |
| 1446 | PxU32 inputEventCS = 0; |
| 1447 | PxU32 userInputCS = 0; |
| 1448 | prepareInputEventUserInputInfo(sampleName, inputEventCS, userInputCS); |
| 1449 | |
| 1450 | // register the additional mapping |
| 1451 | if(mSampleInputAsset) |
| 1452 | { |
| 1453 | std::vector<SampleInputMapping> inputMappings; |
| 1454 | for (size_t i = mSampleInputAsset->GetSampleInputData().size();i--;) |
| 1455 | { |
| 1456 | const SampleInputData& data = mSampleInputAsset->GetSampleInputData()[i]; |
| 1457 | size_t userInputIndex; |
| 1458 | PxI32 userInputId = sampleUserInput->translateUserInputNameToId(data.m_UserInputName,userInputIndex); |
| 1459 | size_t inputEventIndex; |
| 1460 | PxI32 inputEventId = sampleUserInput->translateInputEventNameToId(data.m_InputEventName, inputEventIndex); |
| 1461 | if(userInputId >= 0 && inputEventId >= 0) |
| 1462 | { |
| 1463 | SampleInputMapping mapping; |
| 1464 | mapping.m_InputEventId = inputEventId; |
| 1465 | mapping.m_InputEventIndex = inputEventIndex; |
| 1466 | mapping.m_UserInputId = userInputId; |
| 1467 | mapping.m_UserInputIndex = userInputIndex; |
| 1468 | inputMappings.push_back(mapping); |
| 1469 | } |
| 1470 | else |
| 1471 | { |
| 1472 | PX_ASSERT(0); |
| 1473 | } |
| 1474 | } |
| 1475 | |
| 1476 | for (size_t i = inputMappings.size(); i--;) |
| 1477 | { |
| 1478 | const SampleInputMapping& mapping = inputMappings[i]; |
| 1479 | sampleUserInput->registerInputEvent(mapping); |
| 1480 | } |
| 1481 | } |
| 1482 | |
| 1483 | if (!ignoreSaved) |
| 1484 | parseSampleOutputAsset(sampleName, inputEventCS, userInputCS); |
| 1485 | } |
| 1486 | |
| 1487 | void PhysXSample::onKeyDownEx(SampleFramework::SampleUserInput::KeyCode keyCode, PxU32 param) |
| 1488 | { |
no test coverage detected