diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-10-14 10:21:50 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-10-14 10:21:50 -0600 |
commit | b4befc985875588a4b454b112b8b79a94c26e5e6 (patch) | |
tree | 05f0d7cc50934b076e37fe005533cee1abf872f7 | |
parent | d51d85d49eb0429ba170c13de4ee8b4c277b7937 (diff) | |
download | mana-client-b4befc985875588a4b454b112b8b79a94c26e5e6.tar.gz mana-client-b4befc985875588a4b454b112b8b79a94c26e5e6.tar.bz2 mana-client-b4befc985875588a4b454b112b8b79a94c26e5e6.tar.xz mana-client-b4befc985875588a4b454b112b8b79a94c26e5e6.zip |
Add more detail to DebugWindow
-rw-r--r-- | src/gui/debugwindow.cpp | 33 | ||||
-rw-r--r-- | src/gui/debugwindow.h | 12 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 10 | ||||
-rw-r--r-- | src/gui/setup_video.h | 4 | ||||
-rw-r--r-- | src/resources/image.h | 2 |
5 files changed, 55 insertions, 6 deletions
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 8b991b53..c7a78309 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -22,6 +22,7 @@ #include "gui/debugwindow.h" #include "gui/setup.h" +#include "gui/setup_video.h" #include "gui/viewport.h" #include "gui/widgets/label.h" @@ -30,8 +31,11 @@ #include "engine.h" #include "game.h" #include "particle.h" +#include "main.h" #include "map.h" +#include "resources/image.h" + #include "utils/gettext.h" #include "utils/stringutils.h" @@ -46,19 +50,34 @@ DebugWindow::DebugWindow(): setSaveVisible(true); setDefaultSize(400, 100, ImageRect::CENTER); +#ifdef USE_OPENGL + if (Image::getLoadAsOpenGL()) + { + mFPSText = _("%d FPS (OpenGL)"); + } +#endif + else + { + mFPSText = _("%d FPS"); + } + mFPSLabel = new Label(strprintf(_("%d FPS"), 0)); mMusicFileLabel = new Label(strprintf(_("Music: %s"), "")); mMapLabel = new Label(strprintf(_("Map: %s"), "")); mMinimapLabel = new Label(strprintf(_("Minimap: %s"), "")); mTileMouseLabel = new Label(strprintf(_("Cursor: (%d, %d)"), 0, 0)); mParticleCountLabel = new Label(strprintf(_("Particle count: %d"), 88888)); + mParticleDetailLabel = new Label(); + mAmbientDetailLabel = new Label(); place(0, 0, mFPSLabel, 3); place(3, 0, mTileMouseLabel); place(0, 1, mMusicFileLabel, 3); place(3, 1, mParticleCountLabel); place(0, 2, mMapLabel, 4); + place(3, 2, mParticleDetailLabel); place(0, 3, mMinimapLabel, 4); + place(3, 3, mAmbientDetailLabel); loadWindowState(); } @@ -72,7 +91,7 @@ void DebugWindow::logic() int mouseTileX = (viewport->getMouseX() + viewport->getCameraX()) / 32; int mouseTileY = (viewport->getMouseY() + viewport->getCameraY()) / 32; - mFPSLabel->setCaption(strprintf(_("%d FPS"), fps)); + mFPSLabel->setCaption(strprintf(mFPSText.c_str(), fps)); mTileMouseLabel->setCaption(strprintf(_("Cursor: (%d, %d)"), mouseTileX, mouseTileY)); @@ -96,4 +115,16 @@ void DebugWindow::logic() mParticleCountLabel->setCaption(strprintf(_("Particle count: %d"), Particle::particleCount)); + + mParticleCountLabel->adjustSize(); + + mParticleDetailLabel->setCaption(strprintf(_("Particle detail: %s"), + Setup_Video::particleDetailToString())); + + mParticleDetailLabel->adjustSize(); + + mAmbientDetailLabel->setCaption(strprintf(_("Ambient FX: %s"), + Setup_Video::overlayDetailToString())); + + mAmbientDetailLabel->adjustSize(); } diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index e4c45bde..50a5fc06 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -24,6 +24,8 @@ #include "gui/widgets/window.h" +class Label; + /** * The debug window. * @@ -43,9 +45,13 @@ class DebugWindow : public Window void logic(); private: - gcn::Label *mMusicFileLabel, *mMapLabel, *mMinimapLabel; - gcn::Label *mTileMouseLabel, *mFPSLabel; - gcn::Label *mParticleCountLabel; + Label *mMusicFileLabel, *mMapLabel, *mMinimapLabel; + Label *mTileMouseLabel, *mFPSLabel; + Label *mParticleCountLabel, *mParticleDetailLabel; + Label *mAmbientDetailLabel; + + + std::string mFPSText; }; extern DebugWindow *debugWindow; diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index f21f20e0..a4bd6864 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -146,8 +146,11 @@ static const char *speechModeToString(Being::Speech mode) return ""; } -static const char *overlayDetailToString(int detail) +const char *Setup_Video::overlayDetailToString(int detail) { + if (detail == -1) + detail = config.getValue("OverlayDetail", -1); + switch (detail) { case 0: return _("off"); @@ -157,8 +160,11 @@ static const char *overlayDetailToString(int detail) return ""; } -static const char *particleDetailToString(int detail) +const char *Setup_Video::particleDetailToString(int detail) { + if (detail == -1) + detail = 3 - config.getValue("particleEmitterSkip", -1); + switch (detail) { case 0: return _("low"); diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 01b9cd4f..0bcdabbe 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -44,6 +44,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, /** Called when key is pressed */ void keyPressed(gcn::KeyEvent &event); + static const char *overlayDetailToString(int detail = -1); + + static const char *particleDetailToString(int detail = -1); + private: bool mFullScreenEnabled; bool mOpenGLEnabled; diff --git a/src/resources/image.h b/src/resources/image.h index 9c0f9da7..794506bf 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -179,6 +179,8 @@ class Image : public Resource */ static void setLoadAsOpenGL(bool useOpenGL); + static bool getLoadAsOpenGL() { return mUseOpenGL; } + int getTextureWidth() const { return mTexWidth; } int getTextureHeight() const { return mTexHeight; } static int getTextureType() { return mTextureType; } |