Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CChart.cpp
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | void CChart::SetupText() | ||||
else | else | ||||
for (int i = 0; i < 3; ++i) | for (int i = 0; i < 3; ++i) | ||||
{ | { | ||||
CSize text_size = AddFormattedValue(m_FormatX, m_RightTop.X - (m_RightTop.X - m_LeftBottom.X) / 3 * i, m_Font, m_BufferZone); | CSize text_size = AddFormattedValue(m_FormatX, m_RightTop.X - (m_RightTop.X - m_LeftBottom.X) / 3 * i, m_Font, m_BufferZone); | ||||
m_TextPositions.emplace_back(GetChartRect().BottomRight() - text_size - CPos(width / 3 * i, 0.f)); | m_TextPositions.emplace_back(GetChartRect().BottomRight() - text_size - CPos(width / 3 * i, 0.f)); | ||||
} | } | ||||
} | } | ||||
CSize CChart::AddFormattedValue(const CStrW& format, const float value, const CStrW& font, const float buffer_zone) | CSize CChart::AddFormattedValue(const CStrW& format, const float value, const CStrIntern& font, const float buffer_zone) | ||||
{ | { | ||||
// TODO: we need to catch cases with equal formatted values. | // TODO: we need to catch cases with equal formatted values. | ||||
CGUIString gui_str; | CGUIString gui_str; | ||||
if (format == L"DECIMAL2") | if (format == L"DECIMAL2") | ||||
{ | { | ||||
wchar_t buffer[64]; | wchar_t buffer[64]; | ||||
swprintf(buffer, 64, L"%.2f", value); | swprintf(buffer, 64, L"%.2f", value); | ||||
gui_str.SetValue(buffer); | gui_str.SetValue(buffer); | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator