MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / IsControllerMotion

Function IsControllerMotion

Source/controls/controller_motion.cpp:140–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138} // namespace
139
140bool IsControllerMotion(const SDL_Event &event)
141{
142#ifndef USE_SDL1
143 if (event.type == SDL_CONTROLLERAXISMOTION) {
144 return IsAnyOf(event.caxis.axis,
145 SDL_CONTROLLER_AXIS_LEFTX,
146 SDL_CONTROLLER_AXIS_LEFTY,
147 SDL_CONTROLLER_AXIS_RIGHTX,
148 SDL_CONTROLLER_AXIS_RIGHTY);
149 }
150#endif
151
152 if (event.type == SDL_JOYAXISMOTION) {
153 switch (event.jaxis.axis) {
154#ifdef JOY_AXIS_LEFTX
155 case JOY_AXIS_LEFTX:
156 return true;
157#endif
158#ifdef JOY_AXIS_LEFTX
159 case JOY_AXIS_LEFTY:
160 return true;
161#endif
162#ifdef JOY_AXIS_LEFTX
163 case JOY_AXIS_RIGHTX:
164 return true;
165#endif
166#ifdef JOY_AXIS_LEFTX
167 case JOY_AXIS_RIGHTY:
168 return true;
169#endif
170 default:
171 return false;
172 }
173 }
174
175 return false;
176}
177
178// Updates motion state for mouse and joystick sticks.
179void ProcessControllerMotion(const SDL_Event &event)

Callers 3

GetMenuActionsFunction · 0.85
UiSettingsMenuFunction · 0.85

Calls 1

IsAnyOfFunction · 0.85

Tested by

no test coverage detected