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

Function ui_DoCursor

ui/UISystem.cpp:457–489  ·  view source on GitHub ↗

do cursor display and update

Source from the content-addressed store, hash-verified

455}
456// do cursor display and update
457void ui_DoCursor() {
458 ui_StartDraw(0, 0, UI_screen_width, UI_screen_height);
459
460 rend_SetOverlayType(OT_NONE);
461 rend_SetLighting(LS_NONE);
462 rend_SetColorModel(CM_MONO);
463 rend_SetZBufferState(0);
464 rend_SetAlphaType(AT_CONSTANT + AT_TEXTURE);
465 rend_SetAlphaValue(255);
466
467 // This function needs to get called do if there are no windows, stuff gets drawn using
468 // the ui_StartDraw and ui_EndDraw
469 if (UI_cursor_show && UI_cursor_bm > -1) {
470 ui_MousePoll(false); // DAJ
471
472 float u0 = 0.0f, v0 = 0.0f, u1 = 1.0f, v1 = 1.0f;
473 int cur_w = bm_w(UI_cursor_bm, 0);
474 int cur_h = bm_h(UI_cursor_bm, 0);
475 if (UI_input.mx > (UI_screen_width - cur_w))
476 u1 = ((float)(UI_screen_width - UI_input.mx)) / ((float)cur_w);
477 if (UI_input.my > (UI_screen_height - cur_h))
478 v1 = ((float)(UI_screen_height - UI_input.my)) / ((float)cur_h);
479 if (UI_input.mx < UI_MOUSE_HOTX)
480 u0 = (float)(UI_MOUSE_HOTX - UI_input.mx) / (float)cur_w;
481 if (UI_input.my < UI_MOUSE_HOTY)
482 v0 = (float)(UI_MOUSE_HOTY - UI_input.my) / (float)cur_h;
483 // mprintf_at(1,5,30,"mx=%d my=%d ", UI_input.mx,UI_input.my);
484 rend_DrawScaledBitmap(UI_input.mx - UI_MOUSE_HOTX, UI_input.my - UI_MOUSE_HOTY,
485 UI_input.mx + (int)((float)cur_w * u1) - UI_MOUSE_HOTX,
486 UI_input.my + (int)((float)cur_h * v1) - UI_MOUSE_HOTY, UI_cursor_bm, u0, v0, u1, v1);
487 }
488 ui_EndDraw();
489}
490// ui_DoFrame
491// polls input
492// does a ui frame given a list of windows

Callers 2

ui_DoFrameFunction · 0.85
DoUIMethod · 0.85

Calls 12

ui_StartDrawFunction · 0.85
ui_MousePollFunction · 0.85
bm_wFunction · 0.85
bm_hFunction · 0.85
ui_EndDrawFunction · 0.85
rend_SetOverlayTypeFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetZBufferStateFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetAlphaValueFunction · 0.50
rend_DrawScaledBitmapFunction · 0.50

Tested by

no test coverage detected