MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / processBind

Method processBind

Engine/source/sim/actionMap.cpp:1205–1311  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1203
1204//------------------------------------------------------------------------------
1205bool ActionMap::processBind(const U32 argc, const char** argv, SimObject* object)
1206{
1207 // Ok, the bind will come in the following format:
1208 // [device] [key or button] <[param spec] [param] ...> [fnName]
1209 //
1210 const char* pDeviceName = argv[0];
1211 const char* pEvent = argv[1];
1212 const char* pFnName = argv[argc - 1];
1213
1214 // Determine the device
1215 U32 deviceType;
1216 U32 deviceInst;
1217
1218 if(!getDeviceTypeAndInstance(argv[0], deviceType, deviceInst))
1219 {
1220 Con::printf("processBind: unknown device: %s", pDeviceName);
1221 return false;
1222 }
1223
1224 // Ok, we now have the deviceType and instance. Create an event descriptor
1225 // for the bind...
1226 //
1227 EventDescriptor eventDescriptor;
1228 if (createEventDescriptor(pEvent, &eventDescriptor) == false)
1229 {
1230 Con::printf("Could not create a description for binding: %s", pEvent);
1231 return false;
1232 }
1233
1234 // Event has now been described, and device determined. we need now to extract
1235 // any modifiers that the action map will apply to incoming events before
1236 // calling the bound function...
1237 //
1238 // DMMTODO
1239 U32 assignedFlags = 0;
1240 F32 deadZoneBegin = 0.0f;
1241 F32 deadZoneEnd = 0.0f;
1242 F32 scaleFactor = 1.0f;
1243
1244 if (argc != 3) {
1245 // We have the following: "[DSIR]" [deadZone] [scale]
1246 //
1247 const char* pSpec = argv[2];
1248
1249 for (U32 i = 0; pSpec[i] != '\0'; i++) {
1250 switch (pSpec[i]) {
1251 case 'r': case 'R':
1252 assignedFlags |= Node::Ranged;
1253 break;
1254 case 's': case 'S':
1255 assignedFlags |= Node::HasScale;
1256 break;
1257 case 'd': case 'D':
1258 assignedFlags |= Node::HasDeadZone;
1259 break;
1260 case 'i': case 'I':
1261 assignedFlags |= Node::Inverted;
1262 break;

Callers 1

actionMap.cppFile · 0.80

Calls 5

printfFunction · 0.85
avarFunction · 0.85
dSscanfFunction · 0.85
dAtofFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected