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

Method Draw

ogsr_engine/xrGame/ui/UIProgressShape.cpp:61–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void CUIProgressShape::Draw()
62{
63 if (m_pBackground)
64 m_pBackground->Draw();
65 R_ASSERT(m_pTexture);
66
67 if (m_bText)
68 m_pTexture->DrawText();
69
70 UIRender->SetShader(*m_pTexture->GetShader());
71 Fvector2 tsize;
72 UIRender->GetActiveTextureResolution(tsize);
73
74 //. UIRender->StartTriList(m_sectorCount*3);
75 UIRender->StartPrimitive(m_sectorCount * 3, IUIRender::ptTriList, UI()->m_currentPointType);
76
77 Frect pos_rect;
78 m_pTexture->GetAbsoluteRect(pos_rect);
79 UI()->ClientToScreenScaled(pos_rect.lt, pos_rect.x1, pos_rect.y1);
80 UI()->ClientToScreenScaled(pos_rect.rb, pos_rect.x2, pos_rect.y2);
81
82 Fvector2 center_pos;
83 pos_rect.getcenter(center_pos);
84
85 Frect tex_rect = m_pTexture->GetUIStaticItem().GetOriginalRect();
86
87 tex_rect.lt.x /= tsize.x;
88 tex_rect.lt.y /= tsize.y;
89 tex_rect.rb.x /= tsize.x;
90 tex_rect.rb.y /= tsize.y;
91
92 Fvector2 center_tex;
93 tex_rect.getcenter(center_tex);
94
95 float radius_pos = pos_rect.width() / 2.0f;
96 float radius_tex = tex_rect.width() / 2.0f;
97
98 float curr_angle = m_angle_begin;
99 float sin_a = _sin(curr_angle);
100 float cos_a = _cos(curr_angle);
101 Fvector2 start_pos_pt, prev_pos_pt;
102 Fvector2 start_tex_pt, prev_tex_pt;
103
104 start_pos_pt.set(0.0f, -radius_pos);
105 prev_pos_pt = start_pos_pt;
106
107 start_tex_pt.set(0.0f, -radius_tex);
108 prev_tex_pt = start_tex_pt;
109
110 _make_rot(prev_pos_pt, start_pos_pt, sin_a, cos_a, curr_angle);
111 _make_rot(prev_tex_pt, start_tex_pt, sin_a, cos_a, curr_angle);
112
113 float angle_range = PI_MUL_2;
114 if (m_bClockwise)
115 {
116 angle_range = -abs(m_angle_end - m_angle_begin);
117 }
118 else

Callers

nothing calls this directly

Calls 15

UIFunction · 0.85
_sinFunction · 0.85
_cosFunction · 0.85
_make_rotFunction · 0.85
calc_colorFunction · 0.85
color_argb_fFunction · 0.85
StartPrimitiveMethod · 0.80
GetAbsoluteRectMethod · 0.80
ClientToScreenScaledMethod · 0.80
GetOriginalRectMethod · 0.80
PushPointMethod · 0.80

Tested by

no test coverage detected