summaryrefslogtreecommitdiff
path: root/src/gui/debugwindow.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-05 23:13:55 -0700
committerIra Rice <irarice@gmail.com>2009-03-05 23:13:55 -0700
commitaa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5 (patch)
tree19c5a75a766b7df51ae468fb6b8fdbcfd2c6cc72 /src/gui/debugwindow.cpp
parent93e45964f3b7a0735984616f622ec32b40a21781 (diff)
downloadMana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.gz
Mana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.bz2
Mana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.tar.xz
Mana-aa4229cbb9f2b264ca96c3beedc66b1c79ccc1f5.zip
Made some optimizations based on some profiling done by Octalot, as well
as some other optimizations that I could see that cut down on some unneeded redraws, which in turn improved frame rates slightly. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/debugwindow.cpp')
-rw-r--r--src/gui/debugwindow.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 68b70817..1e199314 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -20,8 +20,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <SDL_mouse.h>
-
#include <guichan/widgets/label.hpp>
#include "debugwindow.h"
@@ -55,28 +53,27 @@ DebugWindow::DebugWindow():
place(0, 0, mFPSLabel);
place(3, 0, mTileMouseLabel);
- place(0, 1, mMusicFileLabel, 2);
+ place(0, 1, mMusicFileLabel, 3);
place(3, 1, mParticleCountLabel);
- place(0, 2, mMapLabel, 2);
- place(0, 3, mMiniMapLabel, 2);
+ place(0, 2, mMapLabel, 4);
+ place(0, 3, mMiniMapLabel, 4);
reflowLayout(375, 0);
}
void DebugWindow::logic()
{
+ if (!isVisible())
+ return;
+
// Get the current mouse position
- int mouseX, mouseY;
- SDL_GetMouseState(&mouseX, &mouseY);
- int mouseTileX = (mouseX + viewport->getCameraX()) / 32;
- int mouseTileY = (mouseY + viewport->getCameraY()) / 32;
+ int mouseTileX = (viewport->getMouseX() + viewport->getCameraX()) / 32;
+ int mouseTileY = (viewport->getMouseY() + viewport->getCameraY()) / 32;
mFPSLabel->setCaption(toString(fps) + " FPS");
- mFPSLabel->adjustSize();
- mTileMouseLabel->setCaption("Mouse: " +
- toString(mouseTileX) + ", " + toString(mouseTileY));
- mTileMouseLabel->adjustSize();
+ mTileMouseLabel->setCaption("Tile: (" + toString(mouseTileX) + ", " +
+ toString(mouseTileY) + ")");
Map *currentMap = engine->getCurrentMap();
if (currentMap)
@@ -84,20 +81,16 @@ void DebugWindow::logic()
const std::string music =
"Music: " + currentMap->getProperty("music");
mMusicFileLabel->setCaption(music);
- mMusicFileLabel->adjustSize();
const std::string minimap =
"MiniMap: " + currentMap->getProperty("minimap");
mMiniMapLabel->setCaption(minimap);
- mMiniMapLabel->adjustSize();
const std::string map =
"Map: " + currentMap->getProperty("_filename");
mMapLabel->setCaption(map);
- mMapLabel->adjustSize();
}
mParticleCountLabel->setCaption("Particle count: " +
toString(Particle::particleCount));
- mParticleCountLabel->adjustSize();
}