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

Method getDeadZone

Engine/source/sim/actionMap.cpp:895–924  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

893
894//------------------------------------------------------------------------------
895const char* ActionMap::getDeadZone( const char* device, const char* action )
896{
897 U32 deviceType;
898 U32 deviceInst;
899 if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
900 {
901 EventDescriptor eventDescriptor;
902 if ( createEventDescriptor( action, &eventDescriptor ) )
903 {
904 const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
905 if ( mapNode )
906 {
907 if ( mapNode->flags & Node::HasDeadZone )
908 {
909 char buf[64];
910 dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd );
911 dsize_t returnLen = dStrlen(buf) + 1;
912 char* returnString = Con::getReturnBuffer( returnLen );
913 dStrcpy( returnString, buf, returnLen );
914 return( returnString );
915 }
916 else
917 return( "0 0" );
918 }
919 }
920 }
921
922 Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
923 return( "" );
924}
925
926//------------------------------------------------------------------------------
927const char* ActionMap::buildActionString( const InputEventInfo* event )

Callers 1

actionMap.cppFile · 0.80

Calls 5

dSprintfFunction · 0.85
getReturnBufferFunction · 0.85
dStrcpyFunction · 0.85
dStrlenFunction · 0.50
errorfFunction · 0.50

Tested by

no test coverage detected