diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-24 19:43:26 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-24 14:55:38 -0700 |
commit | 581206ab0fecbb3afc7afebedac541be51097cf5 (patch) | |
tree | 9734beffe9a54f02abe3457bb4c546a0bb878036 /src/text.cpp | |
parent | c4fd3e6090fb94a77055f4556d906e60e3803d22 (diff) | |
download | mana-581206ab0fecbb3afc7afebedac541be51097cf5.tar.gz mana-581206ab0fecbb3afc7afebedac541be51097cf5.tar.bz2 mana-581206ab0fecbb3afc7afebedac541be51097cf5.tar.xz mana-581206ab0fecbb3afc7afebedac541be51097cf5.zip |
Use standard GUI font also for speech and names
The speech bitmap font can't handle unicode, so it has now been replaced
by the standard GUI font, drawn with a shadow for chat and with a full
outline for names.
Diffstat (limited to 'src/text.cpp')
-rw-r--r-- | src/text.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/text.cpp b/src/text.cpp index 5624bc0a..ba581dab 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -25,12 +25,12 @@ #include "text.h" #include "textmanager.h" -int Text::mInstances = 0; +#include "gui/gui.h" +int Text::mInstances = 0; Text::Text(const std::string &text, int x, int y, - gcn::Graphics::Alignment alignment, gcn::Font *font, - gcn::Color colour) : + gcn::Graphics::Alignment alignment, gcn::Color colour) : mText(text), mColour(colour) { if (textManager == 0) @@ -38,8 +38,8 @@ Text::Text(const std::string &text, int x, int y, textManager = new TextManager(); } ++mInstances; - mHeight = font->getHeight(); - mWidth = font->getWidth(text); + mHeight = gui->getFont()->getHeight(); + mWidth = gui->getFont()->getWidth(text); switch (alignment) { case gcn::Graphics::LEFT: @@ -55,7 +55,6 @@ Text::Text(const std::string &text, int x, int y, mX = x - mXOffset; mY = y; textManager->addText(this); - mFont = font; } void Text::adviseXY(int x, int y) @@ -75,15 +74,31 @@ Text::~Text() void Text::draw(Graphics *graphics, int xOff, int yOff) { - graphics->setFont(mFont); + graphics->setFont(gui->getFont()); + + // Text shadow + graphics->setColor(gcn::Color(0, 0, 0)); + graphics->drawText(mText, mX - xOff + 1, mY - yOff + 1, + gcn::Graphics::LEFT); + + // Text outline + graphics->drawText(mText, mX - xOff + 1, mY - yOff, + gcn::Graphics::LEFT); + graphics->drawText(mText, mX - xOff - 1, mY - yOff, + gcn::Graphics::LEFT); + graphics->drawText(mText, mX - xOff, mY - yOff + 1, + gcn::Graphics::LEFT); + graphics->drawText(mText, mX - xOff, mY - yOff - 1, + gcn::Graphics::LEFT); + graphics->setColor(mColour); graphics->drawText(mText, mX - xOff, mY - yOff, gcn::Graphics::LEFT); } FlashText::FlashText(const std::string &text, int x, int y, - gcn::Graphics::Alignment alignment, gcn::Font *font, - gcn::Color colour) : - Text(text, x, y, alignment, font, colour), mTime(0) + gcn::Graphics::Alignment alignment, gcn::Color colour) : + Text(text, x, y, alignment, colour), + mTime(0) { } |