MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Update

Method Update

Source/Engine/Input/Gamepad.cpp:123–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123bool Gamepad::Update(EventQueue& queue)
124{
125 // Copy state
126 Platform::MemoryCopy(&_mappedPrevState, &_mappedState, sizeof(State));
127 _mappedState.Clear();
128
129 // Gather current state
130 if (UpdateState())
131 return true;
132
133 // Map state
134 for (int32 i = 0; i < (int32)GamepadButton::MAX; i++)
135 {
136 auto e = Layout.Buttons[i];
137 _mappedState.Buttons[static_cast<int32>(e)] = _state.Buttons[i];
138 }
139 for (int32 i = 0; i < (int32)GamepadAxis::MAX; i++)
140 {
141 auto e = Layout.Axis[i];
142 float value = _state.Axis[i];
143 value = Layout.AxisMap[i].X * value + Layout.AxisMap[i].Y;
144 _mappedState.Axis[static_cast<int32>(e)] = value;
145 }
146
147 return false;
148}

Callers

nothing calls this directly

Calls 2

UpdateStateFunction · 0.85
ClearMethod · 0.45

Tested by

no test coverage detected