MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Draw

Method Draw

ogsr_engine/xrGame/ui/UIProgressBar.cpp:95–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void CUIProgressBar::Draw()
96{
97 Frect rect;
98 GetAbsoluteRect(rect);
99
100 if (m_bBackgroundPresent)
101 {
102 UI()->PushScissor(rect);
103 m_UIBackgroundItem.Draw();
104 UI()->PopScissor();
105 }
106
107 Frect progress_rect;
108
109 switch (m_orient_mode)
110 {
111 case om_horz: progress_rect.set(0, 0, m_CurrentLength, GetHeight()); break;
112 case om_vert: progress_rect.set(0, GetHeight() - m_CurrentLength, GetWidth(), GetHeight()); break;
113 case om_back: progress_rect.set(GetWidth() - m_CurrentLength * 1.01f, 0, GetWidth(), GetHeight()); break;
114 case om_down: progress_rect.set(0, 0, GetWidth(), m_CurrentLength); break;
115 case om_fromcenter: {
116 const float center = GetWidth() / 2.f;
117 progress_rect.set(center - m_CurrentLength, 0, center + m_CurrentLength, GetHeight());
118 break;
119 }
120 case om_vfromcenter: {
121 const float center = GetHeight() / 2.f;
122 progress_rect.set(0, center - m_CurrentLength, GetWidth(), center + m_CurrentLength);
123 break;
124 }
125 default: NODEFAULT; break;
126 }
127
128 if (m_CurrentLength > 0)
129 {
130 Fvector2 pos = m_UIProgressItem.GetWndPos();
131 progress_rect.add(rect.left + pos.x, rect.top + pos.y);
132
133 UI()->PushScissor(progress_rect);
134 m_UIProgressItem.Draw();
135 UI()->PopScissor();
136 }
137 m_last_render_frame = Device.dwFrame;
138}

Callers

nothing calls this directly

Calls 8

UIFunction · 0.85
PushScissorMethod · 0.80
PopScissorMethod · 0.80
GetWndPosMethod · 0.80
GetHeightFunction · 0.50
GetWidthFunction · 0.50
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected