20 #include "../Engine/InteractiveSurface.h" 31 enum TextHAlign { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT };
32 enum TextVAlign { ALIGN_TOP, ALIGN_MIDDLE, ALIGN_BOTTOM };
43 Font *_big, *_small, *_font;
45 std::wstring _text, _wrappedText;
46 std::vector<int> _lineWidth, _lineHeight;
47 bool _wrap, _invert, _contrast, _indent;
50 Uint8 _color, _color2;
55 int getLineX(
int line)
const;
58 Text(
int width,
int height,
int x = 0,
int y = 0);
62 static std::wstring
formatNumber(int64_t value,
const std::wstring ¤cy = L
"");
76 void setText(
const std::wstring &text);
void setInvert(bool invert)
Sets the text's color invert setting.
Definition: Text.cpp:203
void setBig()
Sets the text size to big.
Definition: Text.cpp:115
~Text()
Cleans up the text.
Definition: Text.cpp:45
void setHighContrast(bool contrast)
Sets the text's high contrast color setting.
Definition: Text.cpp:214
void setAlign(TextHAlign align)
Sets the text's horizontal alignment.
Definition: Text.cpp:225
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
Uint8 getSecondaryColor() const
Gets the text's secondary color.
Definition: Text.cpp:300
std::wstring getText() const
Gets the text's string.
Definition: Text.cpp:176
Text string displayed on screen.
Definition: Text.h:40
Font * getFont() const
Gets the text's current font.
Definition: Text.cpp:134
int getTextWidth(int line=-1) const
Gets the rendered text's width.
Definition: Text.cpp:337
void setWordWrap(bool wrap, bool indent=false)
Sets the text's wordwrap setting.
Definition: Text.cpp:188
int getTextHeight(int line=-1) const
Gets the rendered text's height.
Definition: Text.cpp:315
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:290
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:45
void initText(Font *big, Font *small, Language *lang)
Initializes the resources for the text.
Definition: Text.cpp:148
void setVerticalAlign(TextVAlign valign)
Sets the text's vertical alignment.
Definition: Text.cpp:246
int getNumLines() const
Gets the number of lines in the (wrapped, if wrapping is enabled) text.
Definition: Text.cpp:305
static std::wstring formatFunding(int64_t funds)
Formats an integer value as currency.
Definition: Text.cpp:94
TextHAlign getAlign() const
Gets the text's horizontal alignment.
Definition: Text.cpp:236
TextVAlign getVerticalAlign() const
Gets the text's vertical alignment.
Definition: Text.cpp:257
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:552
void setText(const std::wstring &text)
Sets the text's string.
Definition: Text.cpp:161
void draw()
Draws the text.
Definition: Text.cpp:549
Uint8 getColor() const
Gets the text's color.
Definition: Text.cpp:279
static std::wstring formatNumber(int64_t value, const std::wstring ¤cy=L"")
Formats an integer value as number with separators.
Definition: Text.cpp:56
void setColor(Uint8 color)
Sets the text's color.
Definition: Text.cpp:268
static std::wstring formatPercentage(int value)
Formats an integer value as percentage.
Definition: Text.cpp:105
void setSmall()
Sets the text size to small.
Definition: Text.cpp:124
Definition: BaseInfoState.cpp:40