Skip to content
Stuart Rutherford edited this page May 16, 2014 · 1 revision

RichText API Reference

This may be bad, but it's better than nothing, right?

sfe::RichText

Return type Function Argument Type(s) Description
(none) (constructor) (none) Creates the sfe::RichText without an sf::Font to use. Text rendered will be invisible until a call to setFont().
(none) (constructor) const sf::Font& Creates the sfe::RichText with an sf::Font to use for any strings it is given.
RichText& operator<< const sf::Color& Makes all text inserted after this have the color specified by the argument given. Defaults to sf::Color::White, and can be overridden by another call to this function. The RichText instance returned is that of the instance whose function is being called.
RichText& operator<< sf::Text::Style Makes all text inserted after this have the style specified by the argument given. Defaults to sf::Text::Regular, and can be overridden by another call to this function. The RichText instance returned is that of the instance whose function is being called.
RichText& operator<< const sf::String& Adds a string to the RichText, with the last color and style specified by their respective functions. The RichText instance returned is that of the instance whose function is being called. "\n" characters are used to split the string into separate lines internally.
void setCharacter std::size_t, std::size_t, sf::Uint32 Sets the (second arg)'th character on the (first arg)'th line to the UInt32 argument. Note that accessing a nonexistent character will cause a crash!
void setCharacterSize unsigned int Sets the pixel (not point!) size of the characters in the RichText. (This applies to strings inserted before and after this call)
void setFont const sf::Font& Sets the font face, applies to strings inserted before and after the call.
void clear (none) Empties the sf::RichText
sf::UInt32 getCharacter std::size_t, std::size_t Gets the (second arg)'th character in the (first arg)'th line. Note that accessing a nonexistent character will cause a crash!
const std::vector& getLines (none) Returns the internal array of sfe::RichText::Line used to store the texts.
unsigned int getCharacterSize (none) Returns the current pixel size of the characters.
const sf::Font* getFont (none) Returns a pointer to the current font
sf::FloatRect getLocalBounds (none) Returns the size of the RichText instance on screen.
sf::FloatRect getGlobalBounds (none) Returns the position of the RichText instance as an sf::FloatRect.

Clone this wiki locally