summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 20:29:06 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 20:29:06 +0000
commitbdb09d26fc6c489228cb2c28be75024f9a49eb75 (patch)
tree28ea782fa98c6fe8b060da71a0bb626781ab1b5d /src/gui
parent9a8456c6c95f5d95c568664ba5adaeb466cfbb0d (diff)
downloadmana-client-bdb09d26fc6c489228cb2c28be75024f9a49eb75.tar.gz
mana-client-bdb09d26fc6c489228cb2c28be75024f9a49eb75.tar.bz2
mana-client-bdb09d26fc6c489228cb2c28be75024f9a49eb75.tar.xz
mana-client-bdb09d26fc6c489228cb2c28be75024f9a49eb75.zip
Accepted Patch by Scraggy that moves text in such a way that no text overlaps
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/viewport.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 9d1e5a1d..e8293acf 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -37,6 +37,7 @@
#include "../map.h"
#include "../monster.h"
#include "../npc.h"
+#include "../textmanager.h"
#include "../resources/animation.h"
#include "../resources/monsterinfo.h"
@@ -226,7 +227,6 @@ Viewport::draw(gcn::Graphics *gcnGraphics)
{
mMap->draw(graphics, (int) mPixelViewX, (int) mPixelViewY);
drawTargetCursor(graphics); // TODO: Draw the cursor with the sprite
- drawTargetName(graphics);
}
// Find a path from the player to the mouse, and draw it. This is for debug
@@ -257,12 +257,16 @@ Viewport::draw(gcn::Graphics *gcnGraphics)
}
}
+ // Draw text
+ if (textManager)
+ {
+ textManager->draw(graphics, mPixelViewX, mPixelViewY);
+ }
+
// Draw player names, speech, and emotion sprite as needed
Beings &beings = beingManager->getAll();
for (BeingIterator i = beings.begin(); i != beings.end(); i++)
{
- (*i)->drawSpeech(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
- (*i)->drawName(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
(*i)->drawEmotion(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
}
@@ -330,24 +334,6 @@ Viewport::drawTargetCursor(Graphics *graphics)
}
void
-Viewport::drawTargetName(Graphics *graphics)
-{
- // Draw target marker if needed
- Being *target = player_node->getTarget();
- if (target && target->getType() == Being::MONSTER)
- {
- graphics->setFont(speechFont);
- graphics->setColor(gcn::Color(255, 32, 32));
-
- const MonsterInfo &mi = static_cast<Monster*>(target)->getInfo();
- int posX = target->getPixelX() + 16 - (int)mPixelViewX;
- int posY = target->getPixelY() + 16 - target->getHeight() - (int)mPixelViewY;
-
- graphics->drawText(mi.getName(), posX, posY, gcn::Graphics::CENTER);
- }
-}
-
-void
Viewport::mousePressed(gcn::MouseEvent &event)
{
// Check if we are alive and kickin'