diff options
author | Bertram <bertram@cegetel.net> | 2010-02-09 02:54:09 +0100 |
---|---|---|
committer | Bertram <bertram@cegetel.net> | 2010-02-09 03:20:48 +0100 |
commit | 6a6b36fa2d19a6ea9d39b975354709e7ad82281d (patch) | |
tree | 09451c98d6a711ffd45a7f5da5796549dbcdd173 /src/gui | |
parent | f3ee70f4aa0b4df7388a4539440355bb066dc0d3 (diff) | |
download | Mana-6a6b36fa2d19a6ea9d39b975354709e7ad82281d.tar.gz Mana-6a6b36fa2d19a6ea9d39b975354709e7ad82281d.tar.bz2 Mana-6a6b36fa2d19a6ea9d39b975354709e7ad82281d.tar.xz Mana-6a6b36fa2d19a6ea9d39b975354709e7ad82281d.zip |
Pushed away some 32 hardcoded values.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/debugwindow.cpp | 25 | ||||
-rw-r--r-- | src/gui/viewport.h | 5 |
2 files changed, 19 insertions, 11 deletions
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 |