Skip to content

Commit 96549e8

Browse files
committed
Fixed missing frame graph when FPS is unlimited. Moved frame graph labels.
1 parent 0b230fa commit 96549e8

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

Client/core/CCore.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,15 +1801,15 @@ void CCore::ApplyFrameRateLimit(uint uiOverrideRate)
18011801

18021802
uint uiUseRate = uiOverrideRate != -1 ? uiOverrideRate : m_uiFrameRateLimit;
18031803

1804-
if (uiUseRate < 1)
1805-
return DoReliablePulse();
1806-
1807-
// Apply previous frame rate if is hasn't been done yet
1808-
ApplyQueuedFrameRateLimit();
1804+
if (uiUseRate > 0)
1805+
{
1806+
// Apply previous frame rate if is hasn't been done yet
1807+
ApplyQueuedFrameRateLimit();
18091808

1810-
// Limit is usually applied in OnGameTimerUpdate
1811-
m_uiQueuedFrameRate = uiUseRate;
1812-
m_bQueuedFrameRateValid = true;
1809+
// Limit is usually applied in OnGameTimerUpdate
1810+
m_uiQueuedFrameRate = uiUseRate;
1811+
m_bQueuedFrameRateValid = true;
1812+
}
18131813

18141814
DoReliablePulse();
18151815

Client/core/CGraphStats.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,14 @@ void CGraphStats::Draw(void)
207207
uint uiSizeY = 150;
208208
uint uiRangeY = 100; // 100ms
209209
float fLineScale = 1 / 1000.f / uiRangeY * uiSizeY;
210-
float fHalfLineHeight = pGraphics->GetDXFontHeight() / 2;
210+
float fLineHeight = pGraphics->GetDXFontHeight();
211211

212212
// Backgroung box
213213
pGraphics->DrawRectQueued(uiOriginX, uiOriginY - uiSizeY, uiSizeX, uiSizeY, SColorRGBA(0, 0, 0, 128), true);
214214

215-
// Draw data line.
215+
// Draw data lines
216+
float fLabelX = uiOriginX + uiSizeX + 22;
217+
float fLabelY = uiOriginY - m_LineList.size() * fLineHeight;
216218
for (const auto& dataLine : m_LineList)
217219
{
218220
const SGraphStatLine& line = dataLine.second;
@@ -230,10 +232,15 @@ void CGraphStats::Draw(void)
230232
iDataPos = GRAPHSTAT_HISTORY_SIZE - 1;
231233

232234
pGraphics->DrawLineQueued(uiOriginX + i - 1, uiOriginY - fY0, uiOriginX + i, uiOriginY - fY1, 1, line.color, true);
235+
236+
if (i == uiSizeX - 1)
237+
{
238+
// Line from graph to label
239+
pGraphics->DrawLineQueued(uiOriginX + i - 1, uiOriginY - fY0, fLabelX - 2, fLabelY + fLineHeight / 2, 1, line.color, true);
240+
}
233241
}
234242

235-
float fX = uiOriginX + uiSizeX + 2;
236-
float fY = uiOriginY - line.dataHistory[line.iDataPos] * fLineScale - fHalfLineHeight;
237-
pGraphics->DrawStringQueued(fX, fY, fX, fY, line.color, line.strName.c_str(), 1.0f, 1.0f, DT_NOCLIP, nullptr, true);
243+
pGraphics->DrawStringQueued(fLabelX, fLabelY, fLabelX, fLabelY, line.color, line.strName.c_str(), 1.0f, 1.0f, DT_NOCLIP, nullptr, true);
244+
fLabelY += fLineHeight;
238245
}
239246
}

0 commit comments

Comments
 (0)