diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/viewport.cpp | 28 |
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' |