MCPcopy Create free account
hub / github.com/defold/defold / MapGamePad

Function MapGamePad

engine/input/src/input.cpp:1262–1290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1260 }
1261
1262 static void MapGamePad(Binding* binding, uint32_t gamepad_index, bool connected)
1263 {
1264 if (connected)
1265 {
1266 GamepadBinding* gamepad_binding = 0x0;
1267
1268 // Try to find if this gamepad index was connected before.
1269 for (uint32_t i = 0; i < binding->m_GamepadBindings.Size(); ++i)
1270 {
1271 GamepadBinding* t = binding->m_GamepadBindings[i];
1272 if (t->m_Index == gamepad_index) {
1273 gamepad_binding = t;
1274 break;
1275 }
1276 }
1277
1278 // If this is an old binding, reset it, otherwise create a new one.
1279 if (gamepad_binding)
1280 {
1281 ResetGamepadBindings(binding, gamepad_binding, gamepad_index);
1282 } else {
1283 gamepad_binding = NewGamepadBinding(binding, gamepad_index);
1284 if (gamepad_binding)
1285 {
1286 binding->m_GamepadBindings.Push(gamepad_binding);
1287 }
1288 }
1289 }
1290 }
1291
1292 bool GamepadConnectivityCallback(uint32_t gamepad_index, bool connected, void* userdata)
1293 {

Callers 2

MapGamePadCbkFunction · 0.85

Calls 4

ResetGamepadBindingsFunction · 0.85
NewGamepadBindingFunction · 0.85
SizeMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected