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

Method Update

ogsr_engine/xrGame/ui/UIButton.cpp:215–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213bool is_in2(const Frect& b1, const Frect& b2) { return (b1.x1 < b2.x1) && (b1.x2 > b2.x2) && (b1.y1 < b2.y1) && (b1.y2 > b2.y2); }
214
215void CUIButton::Update()
216{
217 CUIStatic::Update();
218
219 if (CursorOverWindow() && m_hint_text.size() && !g_btnHint->Owner() && Device.dwTimeGlobal > m_dwFocusReceiveTime + 500)
220 {
221 g_btnHint->SetHintText(this, *m_hint_text);
222
223 Fvector2 c_pos = GetUICursor()->GetCursorPosition();
224 Frect vis_rect;
225 vis_rect.set(0, 0, UI_BASE_WIDTH, UI_BASE_HEIGHT);
226
227 // select appropriate position
228 Frect r;
229 r.set(0.0f, 0.0f, g_btnHint->GetWidth(), g_btnHint->GetHeight());
230 r.add(c_pos.x, c_pos.y);
231
232 r.sub(0.0f, r.height());
233 if (false == is_in2(vis_rect, r))
234 r.sub(r.width(), 0.0f);
235 if (false == is_in2(vis_rect, r))
236 r.add(0.0f, r.height());
237
238 if (false == is_in2(vis_rect, r))
239 r.add(r.width(), 45.0f);
240
241 g_btnHint->SetWndPos(r.lt);
242 }
243}
244
245void CUIButton::OnFocusLost()
246{

Callers

nothing calls this directly

Calls 15

UpdateFunction · 0.85
CursorOverWindowFunction · 0.85
GetUICursorFunction · 0.85
is_in2Function · 0.85
OwnerMethod · 0.80
SetHintTextMethod · 0.80
GetCursorPositionMethod · 0.80
GetWidthMethod · 0.80
GetHeightMethod · 0.80
sizeMethod · 0.45
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected