|
|
@@ -26,6 +26,7 @@ class DebugFpsData |
|
|
|
friend class DebugFps; |
|
|
|
|
|
|
|
private: |
|
|
|
int x, y; |
|
|
|
int fontid; |
|
|
|
}; |
|
|
|
|
|
|
@@ -33,11 +34,13 @@ private: |
|
|
|
* Public DebugFps class |
|
|
|
*/ |
|
|
|
|
|
|
|
DebugFps::DebugFps() |
|
|
|
DebugFps::DebugFps(int x, int y) |
|
|
|
{ |
|
|
|
data = new DebugFpsData(); |
|
|
|
|
|
|
|
data->fontid = Forge::Register("gfx/font/ascii.png"); |
|
|
|
data->x = x; |
|
|
|
data->y = y; |
|
|
|
|
|
|
|
drawgroup = DRAWGROUP_HUD; |
|
|
|
} |
|
|
@@ -49,30 +52,33 @@ void DebugFps::TickDraw(float deltams) |
|
|
|
char buf[1024]; |
|
|
|
Font *font = Forge::GetFont(data->fontid); |
|
|
|
|
|
|
|
int x = data->x; |
|
|
|
int y = data->y; |
|
|
|
|
|
|
|
sprintf(buf, "%2.2f fps (%i)", |
|
|
|
1e3f / Profiler::GetAvg(Profiler::STAT_TICK_FRAME), |
|
|
|
Ticker::GetFrameNum()); |
|
|
|
font->PrintBold(10, 10, buf); |
|
|
|
font->PrintBold(x, y, buf); |
|
|
|
|
|
|
|
sprintf(buf, "Game % 7.2f % 7.2f", |
|
|
|
Profiler::GetAvg(Profiler::STAT_TICK_GAME), |
|
|
|
Profiler::GetMax(Profiler::STAT_TICK_GAME)); |
|
|
|
font->PrintBold(10, 34, buf); |
|
|
|
font->PrintBold(x, y + 24, buf); |
|
|
|
|
|
|
|
sprintf(buf, "Draw % 7.2f % 7.2f", |
|
|
|
Profiler::GetAvg(Profiler::STAT_TICK_DRAW), |
|
|
|
Profiler::GetMax(Profiler::STAT_TICK_DRAW)); |
|
|
|
font->PrintBold(10, 50, buf); |
|
|
|
font->PrintBold(x, y + 40, buf); |
|
|
|
|
|
|
|
sprintf(buf, "Blit % 7.2f % 7.2f", |
|
|
|
Profiler::GetAvg(Profiler::STAT_TICK_BLIT), |
|
|
|
Profiler::GetMax(Profiler::STAT_TICK_BLIT)); |
|
|
|
font->PrintBold(10, 66, buf); |
|
|
|
font->PrintBold(x, y + 56, buf); |
|
|
|
|
|
|
|
sprintf(buf, "Frame % 7.2f % 7.2f", |
|
|
|
Profiler::GetAvg(Profiler::STAT_TICK_FRAME), |
|
|
|
Profiler::GetMax(Profiler::STAT_TICK_FRAME)); |
|
|
|
font->PrintBold(10, 82, buf); |
|
|
|
font->PrintBold(x, y + 72, buf); |
|
|
|
} |
|
|
|
|
|
|
|
DebugFps::~DebugFps() |
|
|
|