From abfc18794cbd9119c110f32e39ea48a00e5b9214 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 7 Sep 2018 01:02:41 +0300 Subject: Add stats tab into debug window. Move LPS counter into stats tab. --- src/gui/widgets/tabs/mapdebugtab.cpp | 25 +++++++--------- src/gui/widgets/tabs/mapdebugtab.h | 1 - src/gui/widgets/tabs/statdebugtab.cpp | 54 +++++++++++++++++++++++++++++++++++ src/gui/widgets/tabs/statdebugtab.h | 43 ++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 16 deletions(-) create mode 100644 src/gui/widgets/tabs/statdebugtab.cpp create mode 100644 src/gui/widgets/tabs/statdebugtab.h (limited to 'src/gui/widgets/tabs') diff --git a/src/gui/widgets/tabs/mapdebugtab.cpp b/src/gui/widgets/tabs/mapdebugtab.cpp index 14dd4184e..6b133e4bb 100644 --- a/src/gui/widgets/tabs/mapdebugtab.cpp +++ b/src/gui/widgets/tabs/mapdebugtab.cpp @@ -86,8 +86,6 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : #endif // DEBUG_BIND_TEXTURE // TRANSLATORS: debug window label, frames per second mFPSLabel(new Label(this, strprintf(_("%d FPS"), 0))), - // TRANSLATORS: debug window label, logic per second - mLPSLabel(new Label(this, strprintf(_("%d LPS"), 0))), mFPSText() { LayoutHelper h(this); @@ -135,20 +133,19 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : #endif // USE_OPENGL place(0, 0, mFPSLabel, 2, 1); - place(0, 1, mLPSLabel, 2, 1); - place(0, 2, mMusicFileLabel, 2, 1); - place(0, 3, mMapLabel, 2, 1); - place(0, 4, mMapNameLabel, 2, 1); - place(0, 5, mMinimapLabel, 2, 1); - place(0, 6, mXYLabel, 2, 1); - place(0, 7, mTileMouseLabel, 2, 1); - place(0, 8, mParticleCountLabel, 2, 1); - place(0, 9, mMapActorCountLabel, 2, 1); + place(0, 1, mMusicFileLabel, 2, 1); + place(0, 2, mMapLabel, 2, 1); + place(0, 3, mMapNameLabel, 2, 1); + place(0, 4, mMinimapLabel, 2, 1); + place(0, 5, mXYLabel, 2, 1); + place(0, 6, mTileMouseLabel, 2, 1); + place(0, 7, mParticleCountLabel, 2, 1); + place(0, 8, mMapActorCountLabel, 2, 1); #ifdef USE_OPENGL - place(0, 10, mMapAtlasCountLabel, 2, 1); + place(0, 9, mMapAtlasCountLabel, 2, 1); #if defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) \ || defined(DEBUG_BIND_TEXTURE) - int n = 11; + int n = 10; #endif // defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) // || defined(DEBUG_BIND_TEXTURE) #ifdef DEBUG_OPENGL_LEAKS @@ -283,7 +280,5 @@ void MapDebugTab::logic() #endif // USE_OPENGL mFPSLabel->setCaption(strprintf(mFPSText.c_str(), fps)); - // TRANSLATORS: debug window label, logic per second - mLPSLabel->setCaption(strprintf(_("%d LPS"), lps)); BLOCK_END("MapDebugTab::logic") } diff --git a/src/gui/widgets/tabs/mapdebugtab.h b/src/gui/widgets/tabs/mapdebugtab.h index 16130b353..340be19af 100644 --- a/src/gui/widgets/tabs/mapdebugtab.h +++ b/src/gui/widgets/tabs/mapdebugtab.h @@ -60,7 +60,6 @@ class MapDebugTab final : public DebugTab #endif // DEBUG_BIND_TEXTURE Label *mFPSLabel A_NONNULLPOINTER; - Label *mLPSLabel A_NONNULLPOINTER; std::string mFPSText; }; diff --git a/src/gui/widgets/tabs/statdebugtab.cpp b/src/gui/widgets/tabs/statdebugtab.cpp new file mode 100644 index 000000000..29fca62de --- /dev/null +++ b/src/gui/widgets/tabs/statdebugtab.cpp @@ -0,0 +1,54 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "gui/widgets/tabs/statdebugtab.h" + +#include "gui/widgets/containerplacer.h" +#include "gui/widgets/label.h" +#include "gui/widgets/layouthelper.h" + +#include "utils/gettext.h" +#include "utils/stringutils.h" +#include "utils/timer.h" + +#include "debug.h" + +StatDebugTab::StatDebugTab(const Widget2 *const widget) : + DebugTab(widget), + // TRANSLATORS: debug window label, logic per second + mLPSLabel(new Label(this, strprintf(_("LPS: %d"), 0))) +{ + LayoutHelper h(this); + ContainerPlacer place = h.getPlacer(0, 0); + + place(0, 0, mLPSLabel, 2, 1); + + place.getCell().matchColWidth(0, 0); + place = h.getPlacer(0, 1); + setDimension(Rect(0, 0, 600, 300)); +} + +void StatDebugTab::logic() +{ + BLOCK_START("StatDebugTab::logic") + // TRANSLATORS: debug window label, logic per second + mLPSLabel->setCaption(strprintf(_("LPS: %d"), lps)); + BLOCK_END("StatDebugTab::logic") +} diff --git a/src/gui/widgets/tabs/statdebugtab.h b/src/gui/widgets/tabs/statdebugtab.h new file mode 100644 index 000000000..d52ff63af --- /dev/null +++ b/src/gui/widgets/tabs/statdebugtab.h @@ -0,0 +1,43 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef GUI_WIDGETS_TABS_STATDEBUGTAB_H +#define GUI_WIDGETS_TABS_STATDEBUGTAB_H + +#include "gui/widgets/tabs/debugtab.h" + +class Label; + +class StatDebugTab final : public DebugTab +{ + friend class DebugWindow; + + public: + explicit StatDebugTab(const Widget2 *const widget); + + A_DELETE_COPY(StatDebugTab) + + void logic() override final; + + private: + Label *mLPSLabel A_NONNULLPOINTER; +}; + +#endif // GUI_WIDGETS_TABS_STATDEBUGTAB_H -- cgit v1.2.3-60-g2f50