MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / processHoldBind

Method processHoldBind

Engine/source/sim/actionMap.cpp:1356–1423  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1354
1355//------------------------------------------------------------------------------
1356bool ActionMap::processHoldBind(const char *device, const char *action, const char *holdFunc, const char *tapFunc, const U32 holdTime, const bool holdOnly, const bool retHoldTime)
1357{
1358 U32 deviceType;
1359 U32 deviceInst;
1360
1361 if (!getDeviceTypeAndInstance(device, deviceType, deviceInst))
1362 {
1363 Con::printf("processBindCmd: unknown device: %s", device);
1364 return false;
1365 }
1366
1367 // Ok, we now have the deviceType and instance. Create an event descriptor
1368 // for the bind...
1369 //
1370 EventDescriptor eventDescriptor;
1371 if (createEventDescriptor(action, &eventDescriptor) == false) {
1372 Con::printf("Could not create a description for binding: %s", action);
1373 return false;
1374 }
1375
1376 // SI_POV == SI_MOVE, and the POV works fine with bindCmd, so we have to add these manually.
1377 if ((eventDescriptor.eventCode == SI_XAXIS) ||
1378 (eventDescriptor.eventCode == SI_YAXIS) ||
1379 (eventDescriptor.eventCode == SI_ZAXIS) ||
1380 (eventDescriptor.eventCode == SI_RXAXIS) ||
1381 (eventDescriptor.eventCode == SI_RYAXIS) ||
1382 (eventDescriptor.eventCode == SI_RZAXIS) ||
1383 (eventDescriptor.eventCode == SI_SLIDER) ||
1384 (eventDescriptor.eventCode == SI_XPOV) ||
1385 (eventDescriptor.eventCode == SI_YPOV) ||
1386 (eventDescriptor.eventCode == SI_XPOV2) ||
1387 (eventDescriptor.eventCode == SI_YPOV2))
1388 {
1389 Con::warnf("ActionMap::processBindCmd - Cannot use 'bindCmd' with a move event type. Use 'bind' instead.");
1390 return false;
1391 }
1392
1393 // Event has now been described, and device determined. we need now to extract
1394 // any modifiers that the action map will apply to incoming events before
1395 // calling the bound function...
1396 //
1397 // DMMTODO
1398 F32 deadZoneBegin = 0.0f;
1399 F32 deadZoneEnd = 0.0f;
1400 F32 scaleFactor = 1.0f;
1401
1402 // Ensure that the console function is properly specified?
1403 //
1404 // DMMTODO
1405
1406 // Create the full bind entry, and place it in the map
1407 //
1408 // DMMTODO
1409 Node* pBindNode = getNode(deviceType, deviceInst,
1410 eventDescriptor.flags,
1411 eventDescriptor.eventCode);
1412
1413 pBindNode->flags = Node::Held;

Callers 1

actionMap.cppFile · 0.80

Calls 3

printfFunction · 0.85
warnfFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected