summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/graphics/gui/CMakeLists.txt1
-rw-r--r--data/graphics/gui/Makefile.am4
-rw-r--r--data/graphics/gui/rpgfont_wider-blue.pngbin4431 -> 0 bytes
-rw-r--r--data/graphics/gui/rpgfont_wider-green.pngbin4423 -> 0 bytes
-rw-r--r--data/graphics/gui/rpgfont_wider-orange.pngbin4415 -> 0 bytes
-rw-r--r--data/graphics/gui/rpgfont_wider.pngbin4382 -> 0 bytes
-rw-r--r--src/being.cpp3
-rw-r--r--src/gui/gui.cpp67
-rw-r--r--src/gui/gui.h11
-rw-r--r--src/gui/ministatus.cpp8
-rw-r--r--src/monster.cpp5
-rw-r--r--src/npc.cpp5
-rw-r--r--src/player.cpp8
-rw-r--r--src/text.cpp35
-rw-r--r--src/text.h7
15 files changed, 38 insertions, 116 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt
index e5ecaa12..e569463c 100644
--- a/data/graphics/gui/CMakeLists.txt
+++ b/data/graphics/gui/CMakeLists.txt
@@ -27,7 +27,6 @@ SET (FILES
radioin.png
radioout.png
resize.png
- rpgfont_wider.png
selection.png
slider.png
speech_bubble.png
diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am
index 1878fe5a..aaccd79a 100644
--- a/data/graphics/gui/Makefile.am
+++ b/data/graphics/gui/Makefile.am
@@ -30,10 +30,6 @@ gui_DATA = \
radioin.png \
radioout.png \
resize.png \
- rpgfont_wider.png \
- rpgfont_wider-blue.png \
- rpgfont_wider-green.png \
- rpgfont_wider-orange.png \
selection.png \
slider.png \
speech_bubble.png \
diff --git a/data/graphics/gui/rpgfont_wider-blue.png b/data/graphics/gui/rpgfont_wider-blue.png
deleted file mode 100644
index b4a27434..00000000
--- a/data/graphics/gui/rpgfont_wider-blue.png
+++ /dev/null
Binary files differ
diff --git a/data/graphics/gui/rpgfont_wider-green.png b/data/graphics/gui/rpgfont_wider-green.png
deleted file mode 100644
index 00098746..00000000
--- a/data/graphics/gui/rpgfont_wider-green.png
+++ /dev/null
Binary files differ
diff --git a/data/graphics/gui/rpgfont_wider-orange.png b/data/graphics/gui/rpgfont_wider-orange.png
deleted file mode 100644
index 18dd67e9..00000000
--- a/data/graphics/gui/rpgfont_wider-orange.png
+++ /dev/null
Binary files differ
diff --git a/data/graphics/gui/rpgfont_wider.png b/data/graphics/gui/rpgfont_wider.png
deleted file mode 100644
index 55ccbbd6..00000000
--- a/data/graphics/gui/rpgfont_wider.png
+++ /dev/null
Binary files differ
diff --git a/src/being.cpp b/src/being.cpp
index a0b870e0..65e9f9d1 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -527,8 +527,7 @@ void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY)
delete mText;
mText = new Text(mSpeech, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET,
- gcn::Graphics::CENTER, speechFont,
- gcn::Color(255, 255, 255));
+ gcn::Graphics::CENTER, gcn::Color(255, 255, 255));
}
else if (mSpeechTime == 0)
{
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 99883151..5314b9ba 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -42,14 +42,14 @@
#include "../resources/resourcemanager.h"
// Guichan stuff
-Gui *gui;
-Viewport *viewport; /**< Viewport on the map. */
-SDLInput *guiInput;
+Gui *gui = 0;
+Viewport *viewport = 0; /**< Viewport on the map. */
+SDLInput *guiInput = 0;
// Fonts used in showing hits
-gcn::Font *hitRedFont;
-gcn::Font *hitBlueFont;
-gcn::Font *hitYellowFont;
+gcn::Font *hitRedFont = 0;
+gcn::Font *hitBlueFont = 0;
+gcn::Font *hitYellowFont = 0;
// Font used to display speech and player names
gcn::Font *speechFont;
@@ -122,60 +122,6 @@ Gui::Gui(Graphics *graphics):
+ e.getMessage());
}
- // Set speech font
- try {
- speechFont = new gcn::ImageFont("graphics/gui/rpgfont_wider.png",
- " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@$\\"
- "áÁéÉíÍóÓúÚç륣¢¡¿àãõêñÑöüäÖÜÄßøèÈåÅ"
- );
- }
- catch (gcn::Exception e)
- {
- logger->error(std::string("Unable to load rpgfont_wider.png: ")
- + e.getMessage());
- }
-
- // Set npc name font
- try {
- npcNameFont = new gcn::ImageFont("graphics/gui/rpgfont_wider-blue.png",
- " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@$\\"
- "áÁéÉíÍóÓúÚç륣¢¡¿àãõêñÑöüäÖÜÄßøèÈåÅ"
- );
- }
- catch (gcn::Exception e)
- {
- logger->error("Unable to load rpgfont_wider-blue.png!");
- }
-
- // Set monster name font
- try {
- mobNameFont = new gcn::ImageFont("graphics/gui/rpgfont_wider-orange.png",
- " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@$\\"
- "áÁéÉíÍóÓúÚç륣¢¡¿àãõêñÑöüäÖÜÄßøèÈåÅ"
- );
- }
- catch (gcn::Exception e)
- {
- logger->error("Unable to load rpgfont_wider-orange.png!");
- }
-
- // Set GM name font
- try {
- gmNameFont = new gcn::ImageFont("graphics/gui/rpgfont_wider-green.png",
- " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@$\\"
- "áÁéÉíÍóÓúÚç륣¢¡¿àãõêñÑöüäÖÜÄßøèÈåÅ"
- );
- }
- catch (gcn::Exception e)
- {
- logger->error("Unable to load rpgfont_wider-green.png!");
- }
-
-
gcn::Widget::setGlobalFont(mGuiFont);
// Load hits' colourful fonts
@@ -219,7 +165,6 @@ Gui::~Gui()
mMouseCursors->decRef();
delete mGuiFont;
- delete speechFont;
delete viewport;
delete getTop();
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 2289ae0b..bb14d4dc 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -124,17 +124,6 @@ extern SDLInput *guiInput; /**< GUI input */
extern gcn::Font *hitRedFont;
extern gcn::Font *hitBlueFont;
extern gcn::Font *hitYellowFont;
-/**
- * Font used to display speech and player names
- */
-extern gcn::Font *speechFont;
-
-/**
- * being name fonts
- */
-extern gcn::Font *npcNameFont;
-extern gcn::Font *mobNameFont;
-extern gcn::Font *gmNameFont;
#endif
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 04901379..f2e466f4 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -54,14 +54,6 @@ MiniStatusWindow::MiniStatusWindow():
mMpLabel->setDimension(mMpBar->getDimension());
mXpLabel->setDimension(mXpBar->getDimension());
- mHpLabel->setForegroundColor(gcn::Color(255, 255, 255));
- mMpLabel->setForegroundColor(gcn::Color(255, 255, 255));
- mXpLabel->setForegroundColor(gcn::Color(255, 255, 255));
-
- mHpLabel->setFont(speechFont);
- mMpLabel->setFont(speechFont);
- mXpLabel->setFont(speechFont);
-
mHpLabel->setAlignment(gcn::Graphics::CENTER);
mMpLabel->setAlignment(gcn::Graphics::CENTER);
mXpLabel->setAlignment(gcn::Graphics::CENTER);
diff --git a/src/monster.cpp b/src/monster.cpp
index f42258bc..4006315b 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -27,8 +27,6 @@
#include "sound.h"
#include "text.h"
-#include "gui/gui.h"
-
#include "resources/monsterdb.h"
#include "utils/tostring.h"
@@ -200,8 +198,7 @@ void Monster::showName(bool show)
{
mText = new Text(getInfo().getName(), mPx + NAME_X_OFFSET,
mPy + NAME_Y_OFFSET - getHeight(),
- gcn::Graphics::CENTER,
- mobNameFont, gcn::Color(255, 32, 32));
+ gcn::Graphics::CENTER, gcn::Color(255, 32, 32));
}
else
{
diff --git a/src/npc.cpp b/src/npc.cpp
index d8bd5468..27388880 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -31,8 +31,6 @@
#include "resources/npcdb.h"
-#include "gui/gui.h"
-
NPC *current_npc = 0;
static const int NAME_X_OFFSET = 15;
@@ -89,8 +87,7 @@ void NPC::setName(const std::string &name)
std::string displayName = name.substr(0, name.find('#', 0));
mName = new Text(displayName, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
- gcn::Graphics::CENTER, npcNameFont,
- gcn::Color(200, 200, 255));
+ gcn::Graphics::CENTER, gcn::Color(200, 200, 255));
Being::setName(displayName + " (NPC)");
}
diff --git a/src/player.cpp b/src/player.cpp
index a72e754d..d62018f2 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -27,8 +27,6 @@
#include "log.h"
#include "player.h"
-#include "gui/gui.h"
-
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
@@ -54,12 +52,10 @@ void Player::setName(const std::string &name)
{
if (mIsGM) {
mName = new FlashText("(GM) " + name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
- gcn::Graphics::CENTER,
- gmNameFont, gcn::Color(255, 255, 255));
+ gcn::Graphics::CENTER, gcn::Color(0, 255, 0));
} else {
mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
- gcn::Graphics::CENTER,
- speechFont, gcn::Color(255, 255, 255));
+ gcn::Graphics::CENTER, gcn::Color(255, 255, 255));
}
Being::setName(name);
}
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)
{
}
diff --git a/src/text.h b/src/text.h
index c2ec4154..03f2dcbc 100644
--- a/src/text.h
+++ b/src/text.h
@@ -37,8 +37,7 @@ class Text
* Constructor creates a text object to display on the screen.
*/
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);
/**
* Destructor. The text is removed from the screen.
@@ -62,7 +61,6 @@ class Text
int mHeight; /**< The height of the text. */
int mXOffset; /**< The offset of mX from the desired x. */
static int mInstances; /**< Instances of text. */
- gcn::Font *mFont; /**< The font used. */
std::string mText; /**< The text to display. */
gcn::Color mColour; /**< The colour of the text. */
};
@@ -71,8 +69,7 @@ class FlashText : public Text
{
public:
FlashText(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);
/**
* Remove the text from the screen