20 #include "../Engine/InteractiveSurface.h" 23 #include "../Engine/Unicode.h" 31 enum TextHAlign { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT };
32 enum TextVAlign { ALIGN_TOP, ALIGN_MIDDLE, ALIGN_BOTTOM };
43 Font *_big, *_small, *_font;
46 UString _processedText;
47 std::vector<int> _lineWidth, _lineHeight;
48 bool _wrap, _invert, _contrast, _indent;
51 Uint8 _color, _color2;
56 int getLineX(
int line)
const;
59 Text(
int width,
int height,
int x = 0,
int y = 0);
71 void setText(
const std::string &text);
void setInvert(bool invert)
Sets the text's color invert setting.
Definition: Text.cpp:141
void setBig()
Sets the text size to big.
Definition: Text.cpp:53
~Text()
Cleans up the text.
Definition: Text.cpp:45
void setHighContrast(bool contrast)
Sets the text's high contrast color setting.
Definition: Text.cpp:152
void setText(const std::string &text)
Sets the text's string.
Definition: Text.cpp:99
void setAlign(TextHAlign align)
Sets the text's horizontal alignment.
Definition: Text.cpp:163
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
Uint8 getSecondaryColor() const
Gets the text's secondary color.
Definition: Text.cpp:238
Text string displayed on screen.
Definition: Text.h:40
Font * getFont() const
Gets the text's current font.
Definition: Text.cpp:72
int getTextWidth(int line=-1) const
Gets the rendered text's width.
Definition: Text.cpp:275
void setWordWrap(bool wrap, bool indent=false)
Sets the text's wordwrap setting.
Definition: Text.cpp:126
int getTextHeight(int line=-1) const
Gets the rendered text's height.
Definition: Text.cpp:253
Contains strings used throughout the game for localization.
Definition: Language.h:39
void setSecondaryColor(Uint8 color)
Sets the text's secondary color.
Definition: Text.cpp:228
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:46
void initText(Font *big, Font *small, Language *lang)
Initializes the resources for the text.
Definition: Text.cpp:86
void setVerticalAlign(TextVAlign valign)
Sets the text's vertical alignment.
Definition: Text.cpp:184
std::string getText() const
Gets the text's string.
Definition: Text.cpp:114
int getNumLines() const
Gets the number of lines in the (wrapped, if wrapping is enabled) text.
Definition: Text.cpp:243
TextHAlign getAlign() const
Gets the text's horizontal alignment.
Definition: Text.cpp:174
TextVAlign getVerticalAlign() const
Gets the text's vertical alignment.
Definition: Text.cpp:195
Text(int width, int height, int x=0, int y=0)
Creates a new text with the specified size and position.
Definition: Text.cpp:38
void invert(Uint8 mid)
Inverts the surface's colors.
Definition: Surface.cpp:592
void draw()
Draws the text.
Definition: Text.cpp:476
Uint8 getColor() const
Gets the text's color.
Definition: Text.cpp:217
void setColor(Uint8 color)
Sets the text's color.
Definition: Text.cpp:206
void setSmall()
Sets the text size to small.
Definition: Text.cpp:62
Definition: BaseInfoState.cpp:40