MCPcopy Create free account
hub / github.com/AntiMicroX/antimicrox / getBindStringForButton

Method getBindStringForButton

src/gamecontroller/gamecontroller.cpp:244–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244QString GameController::getBindStringForButton(int index, bool trueIndex)
245{
246 QString temp = QString();
247
248 SDL_GameControllerButtonBind bind =
249 SDL_GameControllerGetBindForButton(controller, static_cast<SDL_GameControllerButton>(index));
250
251 int offset = trueIndex ? 0 : 1;
252 int bindInt = static_cast<int>(bind.bindType);
253
254 switch (bindInt)
255 {
256 case SDL_CONTROLLER_BINDTYPE_BUTTON:
257 temp.append(QString("Button %1").arg(bind.value.button + offset));
258 break;
259
260 case SDL_CONTROLLER_BINDTYPE_AXIS:
261 temp.append(QString("Axis %1").arg(bind.value.axis + offset));
262 break;
263
264 case SDL_CONTROLLER_BINDTYPE_HAT:
265 temp.append(QString("Hat %1.%2").arg(bind.value.hat.hat + offset).arg(bind.value.hat.hat_mask));
266 break;
267 }
268
269 return temp;
270}
271
272SDL_GameControllerButtonBind GameController::getBindForAxis(int index)
273{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected