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

Method InitProgressBar

ogsr_engine/xrGame/ui/UIXmlInit.cpp:620–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618//////////////////////////////////////////////////////////////////////////
619
620bool CUIXmlInit::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIProgressBar* pWnd)
621{
622 R_ASSERT3(xml_doc.NavigateToNode(path, index), "XML node not found", path);
623
624 string256 buf;
625 Fvector2 pos, size;
626 pos.x = xml_doc.ReadAttribFlt(path, index, "x");
627 pos.y = xml_doc.ReadAttribFlt(path, index, "y");
628
629 InitAlignment(xml_doc, path, index, pos.x, pos.y, pWnd);
630
631 size.x = xml_doc.ReadAttribFlt(path, index, "width");
632 size.y = xml_doc.ReadAttribFlt(path, index, "height");
633
634 CUIProgressBar::EOrientMode mode = CUIProgressBar::om_vert;
635 int mode_horz = xml_doc.ReadAttribInt(path, index, "horz", 0);
636 LPCSTR mode_str = xml_doc.ReadAttrib(path, index, "mode");
637 if (mode_horz == 1) // om_horz
638 {
639 mode = CUIProgressBar::om_horz;
640 }
641 else if (_stricmp(mode_str, "horz") == 0)
642 {
643 mode = CUIProgressBar::om_horz;
644 }
645 else if (_stricmp(mode_str, "vert") == 0)
646 {
647 mode = CUIProgressBar::om_vert;
648 }
649 else if (_stricmp(mode_str, "back") == 0)
650 {
651 mode = CUIProgressBar::om_back;
652 }
653 else if (_stricmp(mode_str, "down") == 0)
654 {
655 mode = CUIProgressBar::om_down;
656 }
657 else if (_stricmp(mode_str, "from_center") == 0)
658 {
659 mode = CUIProgressBar::om_fromcenter;
660 }
661 else if (_stricmp(mode_str, "vert_from_center") == 0)
662 {
663 mode = CUIProgressBar::om_vfromcenter;
664 }
665
666 pWnd->InitProgressBar(pos, size, mode);
667
668 float min = xml_doc.ReadAttribFlt(path, index, "min");
669 float max = xml_doc.ReadAttribFlt(path, index, "max");
670 float ppos = xml_doc.ReadAttribFlt(path, index, "pos");
671
672 pWnd->SetRange(min, max);
673 pWnd->SetProgressPos(ppos);
674 pWnd->m_inertion = xml_doc.ReadAttribFlt(path, index, "inertion", 0.0f);
675 pWnd->m_animated = !!xml_doc.ReadAttribInt(path, index, "animated", pWnd->m_animated ? 1 : 0);
676
677 // progress

Callers 5

InitMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45

Calls 10

GetColorFunction · 0.85
NavigateToNodeMethod · 0.80
ReadAttribFltMethod · 0.80
ReadAttribIntMethod · 0.80
ReadAttribMethod · 0.80
SetProgressPosMethod · 0.80
GetWndSizeMethod · 0.80
SetRangeMethod · 0.45
SetWndSizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected