Builder-style API for configuring and constructing Text_sprites.
The idea is that a Text_sprite::Builder allows configuring a Text_sprite in detail before actually constructing it.
Definition at line 362 of file ge211_sprites.hxx.
Public Member Functions | |
Constructor and builder | |
Builder (Font const &) | |
Constructs a new Text_sprite::Builder with the given Font. | |
Text_sprite | build () const |
Builds the configured Text_sprite. | |
Builder-style setters | |
template<typename PRINTABLE > | |
Builder & | add_message (PRINTABLE const &value) |
Adds to the builder's message. More... | |
template<typename PRINTABLE > | |
Builder & | operator<< (PRINTABLE const &value) |
Adds to the builder's message. More... | |
Builder & | message (std::string const &) |
Replaces the configured message with the given message. More... | |
Builder & | font (Font const &) |
Sets font to use. More... | |
Builder & | color (Color) |
Sets the color to use. More... | |
Builder & | antialias (bool) |
Sets whether to use anti-aliasing. More... | |
Builder & | word_wrap (int) |
Sets the pixel width for wrapping the text. More... | |
Getters | |
std::string | message () const |
Gets the configured message. | |
Font const & | font () const |
Gets the font that will be used. | |
Color | color () const |
Gets the color that will be used. | |
bool | antialias () const |
Gets whether anti-aliasing will be used. | |
int | word_wrap () const |
Gets the wrapping width that will be used. | |
|
inline |
Adds to the builder's message.
This takes any printable type and prints it à la operator<<
. Returns the builder, for call chaining.
Definition at line 383 of file ge211_sprites.hxx.
Text_sprite::Builder & antialias | ( | bool | antialias | ) |
Sets whether to use anti-aliasing.
Anti-aliasing, on by default, makes text smoother but can make it take longer to render. Returns a reference to the Builder for call chaining.
Definition at line 280 of file ge211_sprites.cxx.
Text_sprite::Builder & color | ( | Color | color | ) |
Sets the color to use.
Returns a reference to the Builder for call chaining.
Definition at line 274 of file ge211_sprites.cxx.
Text_sprite::Builder & font | ( | Font const & | font | ) |
Sets font to use.
Returns a reference to the Builder for call chaining.
Definition at line 268 of file ge211_sprites.cxx.
Text_sprite::Builder & message | ( | std::string const & | message | ) |
Replaces the configured message with the given message.
Returns a reference to the Builder for call chaining.
Definition at line 262 of file ge211_sprites.cxx.
|
inline |
Adds to the builder's message.
This is an alias for add_message(const PRINTABLE&).
For example:
Definition at line 403 of file ge211_sprites.hxx.
Text_sprite::Builder & word_wrap | ( | int | word_wrap | ) |
Sets the pixel width for wrapping the text.
If set to 0, the text does not wrap at all. Newlines in the text will produces newlines in the output only if wrapping is on (non-zero). Returns a reference to the Builder for call chaining.
Definition at line 286 of file ge211_sprites.cxx.