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

Method DrawCursor

ogsr_engine/xrGame/ui/UILines.cpp:521–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521void CUILines::DrawCursor(float x, float y)
522{
523 float _h = m_pFont->CurrentHeight_();
524 UI()->ClientToScreenScaledHeight(_h);
525
526 float _w_tmp = 0;
527
528 if (!m_text.empty())
529 {
530 string4096 buff;
531 if (!uFlags.is(flComplexMode))
532 {
533 strncpy_s(buff, m_text.c_str(), m_cursor_pos.x);
534 }
535 else
536 {
537 strcpy_s(buff, "");
538
539 CUILine line = m_lines[m_cursor_pos.y];
540
541 int sz = 0;
542 int size = line.m_subLines.size();
543 for (int i = 0; i < size; i++)
544 {
545 const int line_size = (int)line.m_subLines[i].m_text.size();
546 const char* line_text = line.m_subLines[i].m_text.c_str();
547
548 if (sz + line_size < m_cursor_pos.x)
549 {
550 strcat_s(buff, line_text);
551 sz += line_size;
552 }
553 else
554 {
555 strncat_s(buff, line_text, m_cursor_pos.x - sz);
556 break;
557 }
558 }
559 }
560
561 buff[m_cursor_pos.x] = 0;
562
563 _w_tmp = m_pFont->SizeOf_(buff);
564 }
565
566 UI()->ClientToScreenScaledWidth(_w_tmp);
567
568 Fvector2 outXY;
569 outXY.x = x + _w_tmp;
570 outXY.y = y + (_h + m_interval) * m_cursor_pos.y;
571
572 UI()->ClientToScreenScaled(outXY);
573
574 m_pFont->Out(outXY.x, outXY.y, "_");
575}
576
577void CUILines::Draw()
578{

Callers

nothing calls this directly

Calls 11

UIFunction · 0.85
CurrentHeight_Method · 0.80
isMethod · 0.80
SizeOf_Method · 0.80
ClientToScreenScaledMethod · 0.80
emptyMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
OutMethod · 0.45

Tested by

no test coverage detected