From 6637f4af57cd60008388bfefda1c37376c9d7042 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 20 Nov 2012 13:29:10 +0300 Subject: Add debug option to show draw calls per frame. Also fix map draw and text in debug window with mobile OpenGL. --- src/gui/debugwindow.cpp | 21 ++++++++++++++++++++- src/gui/debugwindow.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 11a8ca3c0..6e11f83c5 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -155,6 +155,10 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : mXYLabel(new Label(this, strprintf("%s (?,?)", _("Player Position:")))), mTexturesLabel(nullptr), mUpdateTime(0), +#ifdef DEBUG_DRAW_CALLS + mDrawCallsLabel(new Label(this, strprintf("%s %s", + _("Draw calls:"), "?"))), +#endif mFPSLabel(new Label(this, strprintf(_("%d FPS"), 0))), mLPSLabel(new Label(this, strprintf(_("%d LPS"), 0))) { @@ -174,6 +178,9 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : case 2: mFPSText = _("%d FPS (old OpenGL)"); break; + case 3: + mFPSText = _("%d FPS (mobile OpenGL)"); + break; }; #else mFPSText = _("%d FPS (Software)"); @@ -189,10 +196,15 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : place(0, 7, mParticleCountLabel, 2); place(0, 8, mMapActorCountLabel, 2); #ifdef USE_OPENGL + int n = 9; #ifdef DEBUG_OPENGL_LEAKS mTexturesLabel = new Label(this, strprintf("%s %s", _("Textures count:"), "?")); - place(0, 9, mTexturesLabel, 2); + place(0, n, mTexturesLabel, 2); + n ++; +#endif +#ifdef DEBUG_DRAW_CALLS + place(0, n, mDrawCallsLabel, 2); #endif #endif place.getCell().matchColWidth(0, 0); @@ -245,6 +257,13 @@ void MapDebugTab::logic() mTexturesLabel->setCaption(strprintf("%s %d", _("Textures count:"), textures_count)); #endif +#ifdef DEBUG_DRAW_CALLS + if (mainGraphics) + { + mDrawCallsLabel->setCaption(strprintf("%s %d", + _("Draw calls:"), mainGraphics->getDrawCalls())); + } +#endif #endif } } diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 5828269c3..62d7aa34f 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -72,6 +72,9 @@ class MapDebugTab final : public DebugTab Label *mXYLabel; Label *mTexturesLabel; int mUpdateTime; +#ifdef DEBUG_DRAW_CALLS + Label *mDrawCallsLabel; +#endif Label *mFPSLabel; Label *mLPSLabel; std::string mFPSText; -- cgit v1.2.3-70-g09d2