mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24: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)
|
||||
{
|
||||
m_MinRange = m_Min = Min;
|
||||
m_MaxRange = m_Max = Max;
|
||||
SetMin(Min);
|
||||
SetMax(Max);
|
||||
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()
|
||||
{
|
||||
m_Min = m_MinRange;
|
||||
|
|
|
@ -47,13 +47,17 @@ public:
|
|||
MAX_VALUES = 128,
|
||||
};
|
||||
|
||||
private:
|
||||
float m_Min, m_Max;
|
||||
float m_MinRange, m_MaxRange;
|
||||
float m_aValues[MAX_VALUES];
|
||||
float m_aColors[MAX_VALUES][3];
|
||||
size_t m_Index;
|
||||
|
||||
public:
|
||||
void Init(float Min, float Max);
|
||||
void SetMin(float Min);
|
||||
void SetMax(float Max);
|
||||
|
||||
void Scale();
|
||||
void Add(float v, float r, float g, float b);
|
||||
|
|
|
@ -183,7 +183,7 @@ void CDebugHud::RenderTuning()
|
|||
}
|
||||
if(i == 0)
|
||||
{
|
||||
m_ZoomedInGraph.m_Min = m_ZoomedInGraph.m_MinRange = RampedSpeed;
|
||||
m_ZoomedInGraph.SetMin(RampedSpeed);
|
||||
}
|
||||
pv = RampedSpeed;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue