![]() |
xyginext
0.2.0
Second generation of xygine game creation framework
|
ECS friendly implementation of Text. Text components should appear on entities which also have a transform and drawable component. Text is drawn with a RenderSystem. NOTE As text is rendered via a drawable component in the same way as sprites and other drawables, the drawable component should use setDepth() to increase the depth value of a text renderable so that it appears above other drawables. This should be the first thing to check if text appears 'invisible'. More...
#include <Text.hpp>
Public Types | |
enum | Alignment { Left, Right, Centre } |
Public Member Functions | |
Text () | |
Default constructor. | |
Text (const sf::Font &) | |
Construct an instance with a given font. | |
void | setFont (const sf::Font &) |
Set the font used with this text. | |
void | setCharacterSize (sf::Uint32) |
Set the character size of the text. | |
void | setVerticalSpacing (float) |
Sets the vertical spacing between rows of text. | |
void | setString (const sf::String &) |
Set the string to be rendered by the text. | |
void | setFillColour (sf::Color) |
Set the fill colour of the text. | |
void | setOutlineColour (sf::Color) |
Set the outline colour of the text. | |
void | setOutlineThickness (float) |
Set the outline thickness. | |
void | setShader (sf::Shader *) |
Set the shader to be applied when rendering this text. Passing nullptr removes any active shader. | |
void | setBlendMode (sf::BlendMode) |
Sets the blend mode used when rendering this text. Defaults to sf::BlendAlpha. | |
const sf::Font * | getFont () const |
Return a pointer to the active font. | |
sf::Uint32 | getCharacterSize () const |
Return the current character size of the text. | |
float | getVerticalSpacing () const |
Returns the current vertical spacing between text rows. | |
const sf::String & | getString () const |
Return the current string rendered by the text. | |
sf::Color | getFillColour () const |
Return the current fill colour of the text. | |
sf::Color | getOutlineColour () const |
Return the current outline colour. | |
float | getOutlineThickness () const |
Return the current outline thickness. | |
const sf::Shader * | getShader () const |
Returns a pointer to this text's active shader. May be nullptr. | |
sf::BlendMode | getBlendMode () const |
Returns this text's current blend mode. | |
void | setCroppingArea (sf::FloatRect) |
Set an area to which to crop the text. The given rectangle should be in local coordinates, relative to the text. | |
sf::FloatRect | getCroppingArea () const |
Returns the current cropping area. | |
void | setAlignment (Alignment) |
Sets whether the text should be aligned left, right or centrally about the origin. Only affects the X axis. | |
Alignment | getAlignment () const |
Returns the text's current alignment. | |
Static Public Member Functions | |
static sf::FloatRect | getLocalBounds (xy::Entity) |
Returns the local (pre-transform) AABB of the text You must pass in an entity which has at least a Text and Drawable component attached to it. | |
Friends | |
class | TextSystem |
ECS friendly implementation of Text. Text components should appear on entities which also have a transform and drawable component. Text is drawn with a RenderSystem. NOTE As text is rendered via a drawable component in the same way as sprites and other drawables, the drawable component should use setDepth() to increase the depth value of a text renderable so that it appears above other drawables. This should be the first thing to check if text appears 'invisible'.