00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef TEXT_H
00024 #define TEXT_H
00025
00026 #include <guichan/color.hpp>
00027
00028 #include "graphics.h"
00029 #include "guichanfwd.h"
00030
00031 class TextManager;
00032
00033 class Text
00034 {
00035 friend class TextManager;
00036
00037 public:
00041 Text(const std::string &text, int x, int y,
00042 gcn::Graphics::Alignment alignment,
00043 const gcn::Color *color, bool isSpeech = false);
00044
00048 virtual ~Text();
00049
00050 void setColor(const gcn::Color *color);
00051
00052 int getWidth() const { return mWidth; }
00053 int getHeight() const { return mHeight; }
00054
00058 void adviseXY(int x, int y);
00059
00063 virtual void draw(gcn::Graphics *graphics, int xOff, int yOff);
00064
00065 private:
00066 int mX;
00067 int mY;
00068 int mWidth;
00069 int mHeight;
00070 int mXOffset;
00071 static int mInstances;
00072 std::string mText;
00073 const gcn::Color *mColor;
00074 bool mIsSpeech;
00076 protected:
00077 static ImageRect mBubble;
00078 static Image *mBubbleArrow;
00079 };
00080
00081 class FlashText : public Text
00082 {
00083 public:
00084 FlashText(const std::string &text, int x, int y,
00085 gcn::Graphics::Alignment alignment,
00086 const gcn::Color* color);
00087
00091 virtual ~FlashText() {}
00092
00096 void flash(int time) {mTime = time; }
00097
00101 virtual void draw(gcn::Graphics *graphics, int xOff, int yOff);
00102
00103 private:
00104 int mTime;
00105 };
00106
00107 #endif // TEXT_H