mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Merge #3988
3988: improved the debug graphs. r=def- a=ChillerDragon
Closes https://github.com/teeworlds/teeworlds/issues/1058
(cherry picked from commit bf61d41c49
)
No hard feelings from my side about the clamp. I am just hunting down em diffs to the upstream. But `@heinrich5991` seemed a bit concerned [back in 2013](https://github.com/teeworlds/teeworlds/issues/1058#issuecomment-12178577)
Old:
![screenshot_2021-08-04_10-12-54](https://user-images.githubusercontent.com/20344300/128148556-e818d45d-a455-4021-89a3-6f61cf187c93.png)
New:
![screenshot_2021-08-04_10-15-08](https://user-images.githubusercontent.com/20344300/128148516-b5a5fc79-2db8-4379-9d20-1a39c4d6285a.png)
## Checklist
- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: oy <Tom_Adams@web.de>
This commit is contained in:
commit
4a77882fcc
|
@ -81,15 +81,15 @@ static const ColorRGBA ClientNetworkErrPrintColor{1.0f, 0.25f, 0.25f, 1.0f};
|
||||||
|
|
||||||
void CGraph::Init(float Min, float Max)
|
void CGraph::Init(float Min, float Max)
|
||||||
{
|
{
|
||||||
m_Min = Min;
|
m_MinRange = m_Min = Min;
|
||||||
m_Max = Max;
|
m_MaxRange = m_Max = Max;
|
||||||
m_Index = 0;
|
m_Index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraph::ScaleMax()
|
void CGraph::ScaleMax()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
m_Max = 0;
|
m_Max = m_MaxRange;
|
||||||
for(i = 0; i < MAX_VALUES; i++)
|
for(i = 0; i < MAX_VALUES; i++)
|
||||||
{
|
{
|
||||||
if(m_aValues[i] > m_Max)
|
if(m_aValues[i] > m_Max)
|
||||||
|
@ -100,7 +100,7 @@ void CGraph::ScaleMax()
|
||||||
void CGraph::ScaleMin()
|
void CGraph::ScaleMin()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
m_Min = m_Max;
|
m_Min = m_MinRange;
|
||||||
for(i = 0; i < MAX_VALUES; i++)
|
for(i = 0; i < MAX_VALUES; i++)
|
||||||
{
|
{
|
||||||
if(m_aValues[i] < m_Min)
|
if(m_aValues[i] < m_Min)
|
||||||
|
@ -1089,7 +1089,11 @@ void CClient::DebugRender()
|
||||||
m_FpsGraph.ScaleMax();
|
m_FpsGraph.ScaleMax();
|
||||||
m_FpsGraph.ScaleMin();
|
m_FpsGraph.ScaleMin();
|
||||||
m_FpsGraph.Render(Graphics(), m_DebugFont, x, sp * 5, w, h, "FPS");
|
m_FpsGraph.Render(Graphics(), m_DebugFont, x, sp * 5, w, h, "FPS");
|
||||||
|
m_InputtimeMarginGraph.ScaleMin();
|
||||||
|
m_InputtimeMarginGraph.ScaleMax();
|
||||||
m_InputtimeMarginGraph.Render(Graphics(), m_DebugFont, x, sp * 5 + h + sp, w, h, "Prediction Margin");
|
m_InputtimeMarginGraph.Render(Graphics(), m_DebugFont, x, sp * 5 + h + sp, w, h, "Prediction Margin");
|
||||||
|
m_GametimeMarginGraph.ScaleMin();
|
||||||
|
m_GametimeMarginGraph.ScaleMax();
|
||||||
m_GametimeMarginGraph.Render(Graphics(), m_DebugFont, x, sp * 5 + h + sp + h + sp, w, h, "Gametime Margin");
|
m_GametimeMarginGraph.Render(Graphics(), m_DebugFont, x, sp * 5 + h + sp + h + sp, w, h, "Gametime Margin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3123,7 +3127,7 @@ void CClient::Run()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//
|
//
|
||||||
m_FpsGraph.Init(0.0f, 200.0f);
|
m_FpsGraph.Init(0.0f, 120.0f);
|
||||||
|
|
||||||
// never start with the editor
|
// never start with the editor
|
||||||
g_Config.m_ClEditor = 0;
|
g_Config.m_ClEditor = 0;
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
float m_Min, m_Max;
|
float m_Min, m_Max;
|
||||||
|
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];
|
||||||
int m_Index;
|
int m_Index;
|
||||||
|
|
Loading…
Reference in a new issue