MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ui_KeyPoll

Function ui_KeyPoll

ui/UISystem.cpp:305–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303 return false;
304}
305bool ui_KeyPoll() {
306 int key;
307 key = ddio_KeyInKey();
308 if (key == KEY_PRINT_SCREEN)
309 UI_input.printscreen = true;
310 UI_input.last_key = UI_input.key;
311 UI_input.last_key_status = UI_input.key_status;
312 // messy hack for pause key
313 if ((key & 0x00ff) == KEY_PAUSE) {
314 key = key & 0xff;
315 }
316 UI_input.key = key;
317 if (UI_input.key) {
318 if (ddio_GetAdjKeyState(UI_input.key)) {
319 UI_input.key_status = UIKEY_PRESSED;
320 UI_input.key_first_press = true;
321 } else {
322 UI_input.key_status = UIKEY_CLICKED;
323 UI_input.key_first_press = true;
324 }
325 } else if (UI_input.last_key && UI_input.last_key_status == UIKEY_PRESSED) {
326 if (ddio_GetAdjKeyState(UI_input.last_key)) {
327 UI_input.key = UI_input.last_key;
328 UI_input.key_status = UIKEY_PRESSED;
329 UI_input.key_first_press = false;
330 } else {
331 UI_input.key_status = UIKEY_RELEASED;
332 UI_input.key = UI_input.last_key;
333 UI_input.key_first_press = false;
334 }
335 } else {
336 UI_input.key_status = 0;
337 UI_input.key_first_press = false;
338 }
339 // mprintf(0, "key=%d status=%d.\n", UI_input.key, UI_input.key_status);
340 return UI_input.key ? true : false;
341}
342// ability to load/use mouse cursors
343void ui_UseCursor(const char *fname) {
344 if (UI_cursor_bm > -1)

Callers 1

ui_ProcessFocusedWindowFunction · 0.85

Calls 2

ddio_KeyInKeyFunction · 0.85
ddio_GetAdjKeyStateFunction · 0.85

Tested by

no test coverage detected