summaryrefslogtreecommitdiff
path: root/src/gui/debugwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/debugwindow.cpp')
-rw-r--r--src/gui/debugwindow.cpp49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 2ed891db..a98c9af4 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -19,11 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <SDL_mouse.h>
-
-#include <guichan/widgets/label.hpp>
-
#include "debugwindow.h"
+#include "label.h"
#include "viewport.h"
#include "widgets/layout.h"
@@ -42,40 +39,38 @@ DebugWindow::DebugWindow():
setResizable(true);
setCloseButton(true);
- setDefaultSize(0, 0, 400, 60);
- loadWindowState();
+ setDefaultSize(400, 100, ImageRect::CENTER);
- mFPSLabel = new gcn::Label("0 FPS");
- mMusicFileLabel = new gcn::Label("Music: ");
- mMapLabel = new gcn::Label("Map: ");
- mMiniMapLabel = new gcn::Label("Mini-Map: ");
- mTileMouseLabel = new gcn::Label("Mouse: 0, 0");
- mParticleCountLabel = new gcn::Label("Particle count: 0");
+ mFPSLabel = new Label("0 FPS");
+ mMusicFileLabel = new Label("Music: ");
+ mMapLabel = new Label("Map: ");
+ mMiniMapLabel = new Label("Mini-Map: ");
+ mTileMouseLabel = new Label("Mouse: 0, 0");
+ mParticleCountLabel = new Label("Particle count: 0");
- place(0, 0, mFPSLabel);
+ place(0, 0, mFPSLabel, 3);
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);
+ loadWindowState();
}
void DebugWindow::logic()
{
+ if (!isVisible())
+ return;
+
// Get the current mouse position
- int mouseX, mouseY;
- SDL_GetMouseState(&mouseX, &mouseY);
- int mouseTileX = mouseX / 32 + viewport->getCameraX();
- int mouseTileY = mouseY / 32 + viewport->getCameraY();
+ 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)
@@ -83,20 +78,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();
}