From 6a6b36fa2d19a6ea9d39b975354709e7ad82281d Mon Sep 17 00:00:00 2001 From: Bertram Date: Tue, 9 Feb 2010 02:54:09 +0100 Subject: Pushed away some 32 hardcoded values. --- src/gui/debugwindow.cpp | 25 ++++++++++++++----------- src/gui/viewport.h | 5 +++++ 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'src/gui') diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 874c57a6..9adbc84f 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -86,22 +86,25 @@ void DebugWindow::logic() if (!isVisible()) return; - // Get the current mouse position - int mouseTileX = (viewport->getMouseX() + viewport->getCameraX()) / 32; - int mouseTileY = (viewport->getMouseY() + viewport->getCameraY()) / 32; - mFPSLabel->setCaption(strprintf(mFPSText.c_str(), fps)); - mTileMouseLabel->setCaption(strprintf(_("Cursor: (%d, %d)"), - mouseTileX, - mouseTileY)); - if (const Map *map = Game::instance()->getCurrentMap()) { + // Get the current mouse position + int mouseTileX = (viewport->getMouseX() + viewport->getCameraX()) + / map->getTileWidth(); + int mouseTileY = (viewport->getMouseY() + viewport->getCameraY()) + / map->getTileHeight(); + mTileMouseLabel->setCaption(strprintf(_("Cursor: (%d, %d)"), + mouseTileX, + mouseTileY)); // TODO: Add gettext support below - mMusicFileLabel->setCaption("Music: " + map->getProperty("music")); - mMinimapLabel->setCaption("Minimap: " + map->getProperty("minimap")); - mMapLabel->setCaption("Map: " + map->getProperty("_filename")); + mMusicFileLabel->setCaption(strprintf( + _("Music: %s"), map->getProperty("music").c_str())); + mMinimapLabel->setCaption( + strprintf(_("Minimap: %s"), map->getProperty("minimap").c_str())); + mMapLabel->setCaption( + strprintf(_("Map: %s"), map->getProperty("_filename").c_str())); } mParticleCountLabel->setCaption(strprintf(_("Particle count: %d"), diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 1143297a..5fced324 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -144,6 +144,11 @@ class Viewport : public WindowContainer, public gcn::MouseListener, */ void scrollBy(float x, float y) { mPixelViewX += x; mPixelViewY += y; } + /** + * Returns the current map object. + */ + Map *getCurrentMap() const { return mMap; } + private: /** * Finds a path from the player to the mouse, and draws it. This is for -- cgit v1.2.3-70-g09d2