mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Encapsulate CGraph
member variables
Make the member variables private and add `SetMin` to replace a usage of the member variables in `CDebugHud`. For completeness/symmetry, `SetMax` is also added.
This commit is contained in:
parent
8c88005a42
commit
967c92f5d6
|
@ -84,11 +84,21 @@ static const ColorRGBA gs_ClientNetworkErrPrintColor{1.0f, 0.25f, 0.25f, 1.0f};
|
||||||
|
|
||||||
void CGraph::Init(float Min, float Max)
|
void CGraph::Init(float Min, float Max)
|
||||||
{
|
{
|
||||||
m_MinRange = m_Min = Min;
|
SetMin(Min);
|
||||||
m_MaxRange = m_Max = Max;
|
SetMax(Max);
|
||||||
m_Index = 0;
|
m_Index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGraph::SetMin(float Min)
|
||||||
|
{
|
||||||
|
m_MinRange = m_Min = Min;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGraph::SetMax(float Max)
|
||||||
|
{
|
||||||
|
m_MaxRange = m_Max = Max;
|
||||||
|
}
|
||||||
|
|
||||||
void CGraph::Scale()
|
void CGraph::Scale()
|
||||||
{
|
{
|
||||||
m_Min = m_MinRange;
|
m_Min = m_MinRange;
|
||||||
|
|
|
@ -47,13 +47,17 @@ public:
|
||||||
MAX_VALUES = 128,
|
MAX_VALUES = 128,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
float m_Min, m_Max;
|
float m_Min, m_Max;
|
||||||
float m_MinRange, m_MaxRange;
|
float m_MinRange, m_MaxRange;
|
||||||
float m_aValues[MAX_VALUES];
|
float m_aValues[MAX_VALUES];
|
||||||
float m_aColors[MAX_VALUES][3];
|
float m_aColors[MAX_VALUES][3];
|
||||||
size_t m_Index;
|
size_t m_Index;
|
||||||
|
|
||||||
|
public:
|
||||||
void Init(float Min, float Max);
|
void Init(float Min, float Max);
|
||||||
|
void SetMin(float Min);
|
||||||
|
void SetMax(float Max);
|
||||||
|
|
||||||
void Scale();
|
void Scale();
|
||||||
void Add(float v, float r, float g, float b);
|
void Add(float v, float r, float g, float b);
|
||||||
|
|
|
@ -183,7 +183,7 @@ void CDebugHud::RenderTuning()
|
||||||
}
|
}
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
m_ZoomedInGraph.m_Min = m_ZoomedInGraph.m_MinRange = RampedSpeed;
|
m_ZoomedInGraph.SetMin(RampedSpeed);
|
||||||
}
|
}
|
||||||
pv = RampedSpeed;
|
pv = RampedSpeed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue