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

Method InputDeviceBitArrayStatus

src/inputdevicebitarraystatus.cpp:29–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include <QDebug>
28
29InputDeviceBitArrayStatus::InputDeviceBitArrayStatus(InputDevice *device, bool readCurrent, QObject *parent)
30 : QObject(parent)
31{
32 for (int i = 0; i < device->getNumberRawAxes(); i++)
33 {
34 SetJoystick *currentSet = device->getActiveSetJoystick();
35 JoyAxis *axis = currentSet->getJoyAxis(i);
36
37 if ((axis != nullptr) && readCurrent)
38 {
39 axesStatus.append(!axis->inDeadZone(axis->getCurrentRawValue()) ? true : false);
40 } else
41 {
42 axesStatus.append(false);
43 }
44 }
45
46 for (int i = 0; i < device->getNumberRawHats(); i++)
47 {
48 SetJoystick *currentSet = device->getActiveSetJoystick();
49 JoyDPad *dpad = currentSet->getJoyDPad(i);
50
51 if ((dpad != nullptr) && readCurrent)
52 {
53 hatButtonStatus.append(dpad->getCurrentDirection() != JoyDPadButton::DpadCentered ? true : false);
54 } else
55 {
56 hatButtonStatus.append(false);
57 }
58 }
59
60 getButtonStatusLocal().resize(device->getNumberRawButtons());
61 getButtonStatusLocal().fill(0);
62
63 for (int i = 0; i < device->getNumberRawButtons(); i++)
64 {
65 SetJoystick *currentSet = device->getActiveSetJoystick();
66 JoyButton *button = currentSet->getJoyButton(i);
67
68 if ((button != nullptr) && readCurrent)
69 {
70 getButtonStatusLocal().setBit(i, button->getButtonState());
71 }
72 }
73
74 m_sensor_status.resize(SENSOR_COUNT);
75 m_sensor_status.fill(0);
76}
77
78void InputDeviceBitArrayStatus::changeAxesStatus(int axisIndex, bool value)
79{

Callers

nothing calls this directly

Calls 11

getActiveSetJoystickMethod · 0.80
getJoyAxisMethod · 0.80
getCurrentRawValueMethod · 0.80
getJoyDPadMethod · 0.80
getButtonStateMethod · 0.80
getNumberRawAxesMethod · 0.45
inDeadZoneMethod · 0.45
getNumberRawHatsMethod · 0.45
getCurrentDirectionMethod · 0.45
getNumberRawButtonsMethod · 0.45
getJoyButtonMethod · 0.45

Tested by

no test coverage detected