Skip to content

Commit

Permalink
xrGame: Added new features stubs for UIProgressBar
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jun 19, 2018
1 parent 0383b14 commit ce6164a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/xrGame/ui/UIProgressBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ void CUIProgressBar::UpdateProgressBar()
}
else
m_UIProgressItem.SetTextureColor(m_maxColor.get());

// XXX: Implement color smoothing
if (colorSmoothing)
R_ASSERT2(false, "color smoothing is not implemented.");
}
}

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

Expand Down
4 changes: 4 additions & 0 deletions src/xrGame/ui/UIProgressBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class CUIProgressBar : public CUIWindow
om_vert = 1,
om_back = 2,
om_down = 3,
om_twoway = 4,
om_vtwoway = 5,
om_tocenter = 6,
om_count
} m_orient_mode;

Expand All @@ -33,6 +36,7 @@ class CUIProgressBar : public CUIWindow
public:
bool m_bUseColor;
bool m_bUseGradient; //Alundaio: if false then use only solid color with m_maxColor
bool colorSmoothing;
Fcolor m_minColor;
Fcolor m_middleColor;
Fcolor m_maxColor;
Expand Down
14 changes: 14 additions & 0 deletions src/xrGame/ui/UIXmlInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,18 @@ bool CUIXmlInit::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIPro
{
mode = CUIProgressBar::om_down;
}
else if (xr_stricmp(mode_str, "two_way") == 0)
{
mode = CUIProgressBar::om_twoway;
}
else if (xr_stricmp(mode_str, "vert_two_way") == 0)
{
mode = CUIProgressBar::om_vtwoway;
}
else if (xr_stricmp(mode_str, "to_center") == 0)
{
mode = CUIProgressBar::om_tocenter;
}

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

Expand All @@ -569,6 +581,8 @@ bool CUIXmlInit::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIPro
pWnd->SetRange(min, max);
pWnd->SetProgressPos(ppos);
pWnd->m_inertion = xml_doc.ReadAttribFlt(path, index, "inertion", 0.0f);
pWnd->colorSmoothing = xml_doc.ReadAttribInt(path, index, "color_smoothing");

// progress
strconcat(sizeof(buf), buf, path, ":progress");

Expand Down

0 comments on commit ce6164a

Please sign in to comment.