MCPcopy Index your code
hub / github.com/stemkoski/stemkoski.github.com / mapPad

Function mapPad

7DFPS/js/gamepad_uncompressed.js:91–110  ·  view source on GitHub ↗
(raw, mapped)

Source from the content-addressed store, hash-verified

89 }
90
91 var mapPad = function(raw, mapped) {
92 var len = active.length;
93 for (var i = 0; i < len; ++i) {
94 var entry = active[i];
95 var ss1 = entry[0];
96 var ss2 = entry[1];
97 if (contains(raw.id, ss1) && contains(raw.id, ss2)) {
98 var handler = entry[2];
99 handler(raw, mapped);
100 var deviceident = entry[3];
101 mapped.name = deviceident + " Player " + (raw.index + 1);
102 mapped.images = entry[4];
103 // todo; apply dead zones to mapped here
104 return;
105 }
106 }
107 mapped.name = "Unknown: " + raw.id;
108 console.warn("Unrecognized pad type, not being mapped!");
109 console.warn(raw.id);
110 };
111
112 var mapIndividualPad = function(rawPads, i) {
113 var raw = rawPads[i];

Callers 1

mapIndividualPadFunction · 0.70

Calls 2

handlerFunction · 0.85
containsFunction · 0.70

Tested by

no test coverage detected