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

Function ResetGamepadBindings

engine/input/src/input.cpp:113–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111 }
112
113 static void ResetGamepadBindings(HBinding binding, GamepadBinding* gamepad_binding, uint32_t gamepad_index)
114 {
115 Action action;
116 memset(&action, 0, sizeof(Action));
117 action.m_IsGamepad = 1;
118 action.m_GamepadUnknown = gamepad_binding->m_Unknown;
119
120 gamepad_binding->m_Index = gamepad_index;
121
122 gamepad_binding->m_Triggers.SetCapacity(binding->m_DDFGamepadTriggersCount);
123 gamepad_binding->m_Triggers.SetSize(0);
124 gamepad_binding->m_Actions.Clear();
125 gamepad_binding->m_Actions.SetCapacity(64, 256);
126
127 action.m_GamepadIndex = gamepad_binding->m_Index;
128 action.m_UserID = 0;
129
130 for (uint32_t i = 0; i < binding->m_DDFGamepadTriggersCount; ++i)
131 {
132 const dmInputDDF::GamepadTrigger& ddf_trigger = binding->m_DDFGamepadTriggersData[i];
133 dmInput::GamepadTrigger trigger;
134 trigger.m_ActionId = dmHashString64(ddf_trigger.m_Action);
135 trigger.m_Input = ddf_trigger.m_Input;
136 gamepad_binding->m_Triggers.Push(trigger);
137 gamepad_binding->m_Actions.Put(trigger.m_ActionId, action);
138 }
139 }
140
141 static GamepadConfig* GetGamepadConfigFromDeviceName(HBinding binding, const uint32_t device_name_hash)
142 {

Callers 2

NewGamepadBindingFunction · 0.85
MapGamePadFunction · 0.85

Calls 5

SetCapacityMethod · 0.45
SetSizeMethod · 0.45
ClearMethod · 0.45
PushMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected