retrieves input for user interface mouse keyboard possibly joystick?
| 260 | // keyboard |
| 261 | // possibly joystick? |
| 262 | bool ui_MousePoll(bool buttons) { |
| 263 | int mx, my; |
| 264 | static int btn_mask = 0; |
| 265 | int msebtn; |
| 266 | bool state; |
| 267 | if (!buttons) { |
| 268 | // get all input, mouse maintains persistent button info. key doesn't. |
| 269 | btn_mask = ddio_MouseGetState(&mx, &my, NULL, NULL); |
| 270 | UI_input.last_mx = UI_input.mx; |
| 271 | UI_input.last_my = UI_input.my; |
| 272 | UI_input.mx = mx; |
| 273 | UI_input.my = my; |
| 274 | } else if (UI_cursor_show) { |
| 275 | // if bX_count is 0, then repeat processing can occur, otherwise only real mouse events are processed. |
| 276 | if (ddio_MouseGetEvent(&msebtn, &state)) { |
| 277 | // mprintf(2, "mouse #%d state %d at %04d %04d\n", msebtn, UI_input.b1_status, UI_input.mx, UI_input.my); |
| 278 | if (msebtn == 0) { |
| 279 | UI_input.b1_last_status = UI_input.b1_status; |
| 280 | UI_input.b1_status = state ? UIMSEBTN_PRESSED : UIMSEBTN_RELEASED; |
| 281 | UI_input.b1_count = 1; |
| 282 | // mprintf(0, "M"); |
| 283 | return true; |
| 284 | } else { |
| 285 | UI_input.b1_status = 0; |
| 286 | } |
| 287 | } else { |
| 288 | if (UI_input.b1_count == 0) { |
| 289 | // this frame, there was no down or up event, so now we can check if we should |
| 290 | // report button 1's state. |
| 291 | UI_input.b1_last_status = UI_input.b1_status; |
| 292 | UI_input.b1_count = 1; |
| 293 | if (CHECK_FLAG(btn_mask, MOUSE_LB)) { |
| 294 | // process repeat key events. |
| 295 | UI_input.b1_status = UIMSEBTN_PRESSED; |
| 296 | // mprintf(0, "m"); |
| 297 | return true; |
| 298 | } |
| 299 | UI_input.b1_status = 0; |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | return false; |
| 304 | } |
| 305 | bool ui_KeyPoll() { |
| 306 | int key; |
| 307 | key = ddio_KeyInKey(); |
no test coverage detected