Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions ogsr_engine/xrGame/ui/UIArtefactPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ void CUIArtefactPanel::InitFromXML(CUIXml& xml, LPCSTR path, int index)
CUIXmlInit::InitWindow(xml, path, index, this);
m_cell_size.x = xml.ReadAttribFlt(path, index, "cell_width");
m_cell_size.y = xml.ReadAttribFlt(path, index, "cell_height");
m_fScale = xml.ReadAttribFlt(path, index, "scale");
m_fScale = xml.ReadAttribFlt(path, index, "scale", 1);
m_iIndent = xml.ReadAttribFlt(path, index, "indent", 1);
m_bVert = xml.ReadAttribInt(path, index, "vert") == 1;
}

void CUIArtefactPanel::InitIcons(const TIItemContainer& artefacts)
Expand All @@ -29,7 +31,6 @@ void CUIArtefactPanel::InitIcons(const TIItemContainer& artefacts)

void CUIArtefactPanel::Draw()
{
const float iIndent = 1.0f;
float x = 0.0f;
float y = 0.0f;
float iHeight;
Expand All @@ -52,7 +53,10 @@ void CUIArtefactPanel::Draw()
m_si.SetRect(0, 0, iWidth, iHeight);

m_si.SetPos(x, y);
x = x + iIndent + iWidth;
if (!m_bVert)
x = x + m_iIndent + iWidth;
else
y = y + m_iIndent + iHeight;

m_si.Render();
}
Expand Down
2 changes: 2 additions & 0 deletions ogsr_engine/xrGame/ui/UIArtefactPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class CUIArtefactPanel : public CUIWindow
void InitFromXML(CUIXml& xml, LPCSTR path, int index);

protected:
bool m_bVert;
float m_iIndent;
float m_fScale;
Fvector2 m_cell_size;
xr_vector<CIconParams*> m_vRects;
Expand Down
6 changes: 5 additions & 1 deletion ogsr_engine/xrGame/ui/UIProgressBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CUIProgressBar::CUIProgressBar()

m_bBackgroundPresent = false;
m_bUseColor = false;
m_bUseMidColor = false;
m_bUseGradient = true;

AttachChild(&m_UIBackgroundItem);
Expand Down Expand Up @@ -55,7 +56,10 @@ void CUIProgressBar::UpdateProgressBar()
if (m_bUseGradient)
{
Fcolor curr;
curr.lerp(m_minColor, m_middleColor, m_maxColor, fCurrentLength);
if (m_bUseMidColor)
curr.lerp(m_minColor, m_middleColor, m_maxColor, fCurrentLength);
else
curr.lerp(m_minColor, m_maxColor, fCurrentLength);
m_UIProgressItem.SetTextureColor(curr.get());
}
else
Expand Down
1 change: 1 addition & 0 deletions ogsr_engine/xrGame/ui/UIProgressBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CUIProgressBar : public CUIWindow

public:
bool m_bUseColor;
bool m_bUseMidColor;
bool m_bUseGradient; // Alundaio: if false then use only solid color with m_maxColor
Fcolor m_minColor;
Fcolor m_middleColor;
Expand Down
9 changes: 6 additions & 3 deletions ogsr_engine/xrGame/ui/UIXmlInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,12 @@ bool CUIXmlInit::InitProgressBar(CUIXml& xml_doc, LPCSTR path, int index, CUIPro
pWnd->m_minColor.set(color);

strconcat(sizeof(buf), buf, path, ":middle_color");

color = GetColor(xml_doc, buf, index, 0xff);
pWnd->m_middleColor.set(color);
if (xml_doc.NavigateToNode(buf, index))
{
pWnd->m_bUseMidColor = true;
color = GetColor(xml_doc, buf, index, 0xff);
pWnd->m_middleColor.set(color);
}

strconcat(sizeof(buf), buf, path, ":max_color");

Expand Down