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

Method Render

ui/UIWindow.cpp:553–607  ·  view source on GitHub ↗

redraw all gadgets

Source from the content-addressed store, hash-verified

551
552// redraw all gadgets
553void UIWindow::Render() {
554 UIGadget *gadget = m_GadgetHead;
555
556 // draw background of window.
557 ui_StartDraw(m_X, m_Y, m_X + m_W, m_Y + m_H);
558 ui_DrawSetFont(m_FontHandle);
559
560 OnDraw();
561 ui_EndDraw();
562
563 while (gadget) {
564 int l = m_X + gadget->X();
565 int t = m_Y + gadget->Y();
566 int r = l + gadget->W();
567 int b = t + gadget->H();
568
569 // reformat gadget
570 gadget->OnFormat();
571
572 // draw gadget
573 if (l >= 0 && r <= UI_screen_width && t >= 0 && b <= UI_screen_height) {
574 ui_StartDraw(l, t, r, b);
575 ui_DrawSetFont(m_FontHandle);
576 gadget->OnDraw();
577 ui_EndDraw();
578 } else {
579 mprintf(0, "WINDOW: Gadget clipped on screen border (%d,%d,%d,%d)\n", l, t, r, b);
580 // Int3();
581 }
582
583 // proeceed...
584 gadget = gadget->m_Next;
585 }
586
587 UITextItem::SetSaturationFactor(0);
588
589// draw ugly looking focus box around current gadget.
590#if 0
591 if (m_GadgetCur && !CHECK_FLAG(m_GadgetCur->m_Flags, UIF_SLAVE) ) {
592 int l = m_X+m_GadgetCur->X();
593 int t = m_Y+m_GadgetCur->Y();
594 int r = l+m_GadgetCur->W();
595 int b = t+m_GadgetCur->H();
596
597 l--; t--; r++; b++;
598 if (l < 0) l = 0;
599 if (t < 0) t = 0;
600 if (r >(m_X+m_W)) r = m_X+m_W;
601 if (b >(m_Y+m_H)) b = m_Y+m_H;
602 ui_StartDraw(l,t,r,b);
603 ui_DrawBox(GR_RGB(128,128,128),0,0,(r-l),(b-t));
604 ui_EndDraw();
605 }
606#endif
607}
608
609// adds window to ui list.
610void UIWindow::Open() { ui_AddWindow(this); }

Callers 1

ui_UpdateWindowsFunction · 0.45

Calls 11

ui_StartDrawFunction · 0.85
ui_DrawSetFontFunction · 0.85
ui_EndDrawFunction · 0.85
ui_DrawBoxFunction · 0.85
WMethod · 0.80
HMethod · 0.80
GR_RGBFunction · 0.50
XMethod · 0.45
YMethod · 0.45
OnFormatMethod · 0.45
OnDrawMethod · 0.45

Tested by

no test coverage detected