--------------------------------------------------------------
| 110 | |
| 111 | //-------------------------------------------------------------- |
| 112 | void PSMoveMgr::Update() |
| 113 | { |
| 114 | for (int i = 0; i < MAX_NUM_PS_MOVES; ++i) |
| 115 | { |
| 116 | if (mMove[i]) |
| 117 | { |
| 118 | _PSMove* move = mMove[i]; |
| 119 | int res = 1; |
| 120 | while (res) |
| 121 | res = psmove_poll(move); //poll until there's no new data, so we have the freshest |
| 122 | |
| 123 | int currentButtons = psmove_get_buttons(move); |
| 124 | int change = currentButtons ^ mButtons[i]; |
| 125 | int pressed = currentButtons & change; |
| 126 | int released = mButtons[i] & change; |
| 127 | mButtons[i] = currentButtons; |
| 128 | if (Btn_TRIANGLE & pressed) |
| 129 | SendButtonMessage(i, "triangle", 1); |
| 130 | if (Btn_TRIANGLE & released) |
| 131 | SendButtonMessage(i, "triangle", 0); |
| 132 | if (Btn_CIRCLE & pressed) |
| 133 | SendButtonMessage(i, "circle", 1); |
| 134 | if (Btn_CIRCLE & released) |
| 135 | SendButtonMessage(i, "circle", 0); |
| 136 | if (Btn_CROSS & pressed) |
| 137 | SendButtonMessage(i, "cross", 1); |
| 138 | if (Btn_CROSS & released) |
| 139 | SendButtonMessage(i, "cross", 0); |
| 140 | if (Btn_SQUARE & pressed) |
| 141 | SendButtonMessage(i, "square", 1); |
| 142 | if (Btn_SQUARE & released) |
| 143 | SendButtonMessage(i, "square", 0); |
| 144 | if (Btn_SELECT & pressed) |
| 145 | SendButtonMessage(i, "select", 1); |
| 146 | if (Btn_SELECT & released) |
| 147 | SendButtonMessage(i, "select", 0); |
| 148 | if (Btn_START & pressed) |
| 149 | SendButtonMessage(i, "start", 1); |
| 150 | if (Btn_START & released) |
| 151 | SendButtonMessage(i, "start", 0); |
| 152 | if (Btn_PS & pressed) |
| 153 | SendButtonMessage(i, "ps", 1); |
| 154 | if (Btn_PS & released) |
| 155 | SendButtonMessage(i, "ps", 0); |
| 156 | if (Btn_MOVE & pressed) |
| 157 | SendButtonMessage(i, "move", 1); |
| 158 | if (Btn_MOVE & released) |
| 159 | SendButtonMessage(i, "move", 0); |
| 160 | if (Btn_T & pressed) |
| 161 | SendButtonMessage(i, "trigger", 1); |
| 162 | if (Btn_T & released) |
| 163 | SendButtonMessage(i, "trigger", 0); |
| 164 | |
| 165 | psmove_update_leds(move); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 |
no test coverage detected