Skip to content

Commit ce6164a

Browse files
committed
xrGame: Added new features stubs for UIProgressBar
1 parent 0383b14 commit ce6164a

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/xrGame/ui/UIProgressBar.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ void CUIProgressBar::UpdateProgressBar()
6262
}
6363
else
6464
m_UIProgressItem.SetTextureColor(m_maxColor.get());
65+
66+
// XXX: Implement color smoothing
67+
if (colorSmoothing)
68+
R_ASSERT2(false, "color smoothing is not implemented.");
6569
}
6670
}
6771

@@ -112,6 +116,10 @@ void CUIProgressBar::Draw()
112116
case om_vert: progress_rect.set(0, GetHeight() - m_CurrentLength, GetWidth(), GetHeight()); break;
113117
case om_back: progress_rect.set(GetWidth() - m_CurrentLength * 1.01f, 0, GetWidth(), GetHeight()); break;
114118
case om_down: progress_rect.set(0, 0, GetWidth(), m_CurrentLength); break;
119+
// XXX: Implement two-way progress bar
120+
case om_twoway: R_ASSERT2(false, "two_way mode is not implemented."); break;
121+
case om_vtwoway: R_ASSERT2(false, "vert_two_way mode is not implemented."); break;
122+
case om_tocenter: R_ASSERT2(false, "from_edges_to_center mode is not implemented."); break;
115123
default: NODEFAULT; break;
116124
}
117125

src/xrGame/ui/UIProgressBar.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class CUIProgressBar : public CUIWindow
1616
om_vert = 1,
1717
om_back = 2,
1818
om_down = 3,
19+
om_twoway = 4,
20+
om_vtwoway = 5,
21+
om_tocenter = 6,
1922
om_count
2023
} m_orient_mode;
2124

@@ -33,6 +36,7 @@ class CUIProgressBar : public CUIWindow
3336
public:
3437
bool m_bUseColor;
3538
bool m_bUseGradient; //Alundaio: if false then use only solid color with m_maxColor
39+
bool colorSmoothing;
3640
Fcolor m_minColor;
3741
Fcolor m_middleColor;
3842
Fcolor m_maxColor;

src/xrGame/ui/UIXmlInit.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,18 @@ bool CUIXmlInit::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIPro
559559
{
560560
mode = CUIProgressBar::om_down;
561561
}
562+
else if (xr_stricmp(mode_str, "two_way") == 0)
563+
{
564+
mode = CUIProgressBar::om_twoway;
565+
}
566+
else if (xr_stricmp(mode_str, "vert_two_way") == 0)
567+
{
568+
mode = CUIProgressBar::om_vtwoway;
569+
}
570+
else if (xr_stricmp(mode_str, "to_center") == 0)
571+
{
572+
mode = CUIProgressBar::om_tocenter;
573+
}
562574

563575
pWnd->InitProgressBar(pos, size, mode);
564576

@@ -569,6 +581,8 @@ bool CUIXmlInit::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIPro
569581
pWnd->SetRange(min, max);
570582
pWnd->SetProgressPos(ppos);
571583
pWnd->m_inertion = xml_doc.ReadAttribFlt(path, index, "inertion", 0.0f);
584+
pWnd->colorSmoothing = xml_doc.ReadAttribInt(path, index, "color_smoothing");
585+
572586
// progress
573587
strconcat(sizeof(buf), buf, path, ":progress");
574588

0 commit comments

Comments
 (0)