MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / GameLoop_HandleEvents

Function GameLoop_HandleEvents

src/opendune.c:397–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397static uint16 GameLoop_HandleEvents(const char **strings)
398{
399 uint8 last;
400 uint16 result;
401 uint16 key;
402 uint16 top;
403 uint16 left;
404 uint16 minX;
405 uint16 maxX;
406 uint16 minY;
407 uint16 maxY;
408 uint16 lineHeight;
409 uint8 fgColourNormal;
410 uint8 fgColourSelected;
411 uint8 old;
412 WidgetProperties *props;
413 uint8 current;
414
415 props = &g_widgetProperties[21];
416
417 last = props->height - 1;
418 old = props->fgColourBlink % (last + 1);
419 current = old;
420
421 result = 0xFFFF;
422
423 top = g_curWidgetYBase + props->yBase;
424 left = (g_curWidgetXBase + props->xBase) << 3;
425
426 lineHeight = g_fontCurrent->height;
427
428 minX = (g_curWidgetXBase << 3) + (g_fontCurrent->maxWidth * props->xBase);
429 minY = g_curWidgetYBase + props->yBase;
430 maxX = minX + (g_fontCurrent->maxWidth * props->width) - 1;
431 maxY = minY + (props->height * lineHeight) - 1;
432
433 fgColourNormal = props->fgColourNormal;
434 fgColourSelected = props->fgColourSelected;
435
436 key = 0;
437 if (Input_IsInputAvailable() != 0) {
438 key = Input_Wait() & 0x8FF;
439 }
440
441 if (g_mouseDisabled == 0) {
442 uint16 y = g_mouseY;
443
444 if (GameLoop_IsInRange(g_mouseX, y, minX, minY, maxX, maxY)) {
445 current = (y - minY) / lineHeight;
446 }
447 }
448
449 switch (key) {
450 case 0x60: /* NUMPAD 8 / ARROW UP */
451 if (current-- == 0) current = last;
452 break;
453
454 case 0x62: /* NUMPAD 2 / ARROW DOWN */

Callers 1

Calls 8

Input_IsInputAvailableFunction · 0.85
Input_WaitFunction · 0.85
GameLoop_IsInRangeFunction · 0.85
GUI_Mouse_Hide_SafeFunction · 0.85
GUI_DrawText_WrapperFunction · 0.85
GUI_Mouse_Show_SafeFunction · 0.85
GameLoop_DrawText2Function · 0.85

Tested by

no test coverage detected