MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
Mezzanine::UI::Character Class Reference

This class creates and encapsultes a character that can be used in text renders. More...

#include <character.h>

+ Collaboration diagram for Mezzanine::UI::Character:

Public Member Functions

 Character (const UInt32 &GlyphID, const CharacterTraits &Traits, TextLayer *Creator)
 GlyphID Constructor. More...
 
 Character (Glyph *CharacterGlyph, TextLayer *Creator)
 Glyph Constructor. More...
 
 Character (Glyph *CharacterGlyph, const CharacterTraits &Traits, TextLayer *Creator)
 Styled Glyph Constructor. More...
 
 Character (Sprite *CharacterSprite, TextLayer *Creator)
 Sprite Constructor. More...
 
 Character (Sprite *CharacterSprite, const CharacterTraits &Traits, TextLayer *Creator)
 Styled Sprite Constructor. More...
 
TextureAtlasGetAtlas () const
 Gets the atlas this character is using for rendering. More...
 
Vector2 GetAtlasCoords (const UI::QuadCorner Corner) const
 Gets the atlas coordinates of a quad corner. More...
 
const StringGetAtlasName () const
 Gets the name of the atlas this character is using for rendering. More...
 
Vector2 GetAtlasWhitePixel () const
 Gets the coordinates to the white pixel on the atlas this character belongs to. More...
 
Real GetCharacterAdvance (Glyph *Prev) const
 Gets the amount of pixels to advance the cursor after placing this character. More...
 
const ColourValueGetCharacterColour () const
 Gets the fill colour of this character. More...
 
Vector2 GetCharacterSize () const
 Gets the rendered size of this character. More...
 
GlyphGetCharGlyph () const
 Gets the glyph being rendered by this character. More...
 
SpriteGetCharSprite () const
 Gets the sprite being rendered by this character. More...
 
Boolean GetHighlighted () const
 Gets if this character is being highlighted. More...
 
Real GetLengthOffset () const
 Gets the length offset of this Character. More...
 
Real GetLineHeight () const
 Gets the height a line needs to be to support rendering this character. More...
 
Vector2 GetRelativeAtlasCoords (const UI::QuadCorner Corner) const
 Gets the relative atlas coordinates of a quad corner. More...
 
const CharacterTraitsGetTraits () const
 Gets this Characters sharable traits. More...
 
Real GetUnscaledCharacterAdvance (Glyph *Prev) const
 Gets the amount of pixels to advance the cursor after placing this character without scaling applied. More...
 
Vector2 GetUnscaledCharacterSize () const
 Gets the rendered size of this character without any scaling applied. More...
 
Real GetUnscaledLineHeight () const
 Gets the height a line needs to be to support rendering this character without scaling applied. More...
 
Real GetUnscaledVerticalOffset () const
 Gets the vertical adjustment for this character without scaling applied. More...
 
Real GetVerticalOffset () const
 Gets the vertical adjustment for this character. More...
 
Boolean IsCustomSizeSet () const
 Whether or not the custom size has been set. More...
 
Boolean IsGlyph () const
 Gets whether or not this character is a glyph. More...
 
Boolean IsHighlightable () const
 Gets if this character can be highlighted. More...
 
Boolean IsNewLine () const
 Gets if this character is a line break character. More...
 
Boolean IsRenderable () const
 Gets if this character contains valid data for rendering. More...
 
Boolean IsSprite () const
 Gets whether or not this character is a sprite. More...
 
Boolean IsWhiteSpace () const
 Gets if this character is a whitespace glyph. More...
 
void SetCharacterColour (const ColourValue &Colour)
 Sets the fill colour for this character. More...
 
void SetCustomSize (const Vector2 &Size)
 Sets the custom size this character is to be resized to. More...
 
void SetHighlighted (Boolean Highlight)
 Sets whether or not this character should be highlighted. More...
 
void SetLengthOffset (const Real &Offset)
 Sets the offset from the position of the parent TextLine. More...
 
void SetTraits (const CharacterTraits &Traits)
 Sets this Characters sharable traits. More...
 

Protected Attributes

GlyphCharGlyph
 A pointer to the Glyph this character is being rendered as, or NULL if it is a Sprite. More...
 
SpriteCharSprite
 A pointer to the Sprite this character is being rendered as, or NULL if it is a Glyph. More...
 
CharacterTraits CharTraits
 The rendering traits of this character. More...
 
Vector2 CustomSize
 The forced size of this character, if it is set. More...
 
Boolean Highlighted
 Stores whether or not this character is being highlighted. More...
 
TextLayerLayer
 A pointer to the layer this character is being rendered by. More...
 
Real LengthOffset
 The X-axis offset from the left side where this character is being rendered relative to the TextLine position. More...
 

Detailed Description

This class creates and encapsultes a character that can be used in text renders.

Definition at line 59 of file character.h.

Constructor & Destructor Documentation

Mezzanine::UI::Character::Character ( const UInt32 GlyphID,
const CharacterTraits Traits,
TextLayer Creator 
)

GlyphID Constructor.

Parameters
GlyphIDThe ID of the glyph to be used when creating this character.
TraitsThe sharable metadata to be given to this Character.
CreatorThe TextLayer that created this Character.

Definition at line 56 of file character.cpp.

Mezzanine::UI::Character::Character ( Glyph CharacterGlyph,
TextLayer Creator 
)

Glyph Constructor.

Parameters
CharacterGlyphThe glyph used when rendering this Character.
CreatorThe TextLayer that created this Character.

Definition at line 72 of file character.cpp.

Mezzanine::UI::Character::Character ( Glyph CharacterGlyph,
const CharacterTraits Traits,
TextLayer Creator 
)

Styled Glyph Constructor.

Parameters
CharacterGlyphThe glyph used when rendering this Character.
TraitsThe sharable metadata to be given to this Character.
CreatorThe TextLayer that created this Character.

Definition at line 85 of file character.cpp.

Mezzanine::UI::Character::Character ( Sprite CharacterSprite,
TextLayer Creator 
)

Sprite Constructor.

Parameters
CharacterSpriteThe sprite used when rendering this character.
CreatorThe TextLayer that created this Character.

Definition at line 101 of file character.cpp.

Mezzanine::UI::Character::Character ( Sprite CharacterSprite,
const CharacterTraits Traits,
TextLayer Creator 
)

Styled Sprite Constructor.

Parameters
CharacterSpriteThe sprite used when rendering this character.
TraitsThe sharable metadata to be given to this Character.
CreatorThe TextLayer that created this Character.

Definition at line 114 of file character.cpp.

Member Function Documentation

TextureAtlas * Mezzanine::UI::Character::GetAtlas ( ) const

Gets the atlas this character is using for rendering.

Returns
Returns a pointer to this characters atlas.

Definition at line 196 of file character.cpp.

Vector2 Mezzanine::UI::Character::GetAtlasCoords ( const UI::QuadCorner  Corner) const

Gets the atlas coordinates of a quad corner.

Parameters
CornerThe corner to get the atlas coordinates for.
Returns
Returns a Vector2 containing the Atlas pixel position of the requested corner.

Definition at line 221 of file character.cpp.

const String & Mezzanine::UI::Character::GetAtlasName ( ) const

Gets the name of the atlas this character is using for rendering.

Returns
Returns a const String reference containing the name of this characters atlas.

Definition at line 207 of file character.cpp.

Vector2 Mezzanine::UI::Character::GetAtlasWhitePixel ( ) const

Gets the coordinates to the white pixel on the atlas this character belongs to.

Returns
Returns a Vector2 containing the relative coordinates of the atlas whitepixel.

Definition at line 216 of file character.cpp.

Real Mezzanine::UI::Character::GetCharacterAdvance ( Glyph Prev) const

Gets the amount of pixels to advance the cursor after placing this character.

Parameters
PrevThe glyph prior to this one in the parent TextLine. Needed for kerning information.
Returns
Returns a Real representing the number of pixels to advance.

Definition at line 129 of file character.cpp.

const ColourValue & Mezzanine::UI::Character::GetCharacterColour ( ) const

Gets the fill colour of this character.

Returns
Returns a const colourvalue reference containing the fill colour of this character.

Definition at line 245 of file character.cpp.

Vector2 Mezzanine::UI::Character::GetCharacterSize ( ) const

Gets the rendered size of this character.

Returns
Returns a Vector2 containing the size this character is to be rendered at after scaling.

Definition at line 334 of file character.cpp.

Glyph * Mezzanine::UI::Character::GetCharGlyph ( ) const

Gets the glyph being rendered by this character.

Returns
Returns a pointer to the glyph this character is representing, or NULL if this character is a Sprite.

Definition at line 368 of file character.cpp.

Sprite * Mezzanine::UI::Character::GetCharSprite ( ) const

Gets the sprite being rendered by this character.

Returns
Returns a pointer to the sprite this character is representing, or NULL if this character is a Glyph.

Definition at line 371 of file character.cpp.

Boolean Mezzanine::UI::Character::GetHighlighted ( ) const

Gets if this character is being highlighted.

Returns
Returns true if this character is being highlighted, false otherwise.

Definition at line 255 of file character.cpp.

Real Mezzanine::UI::Character::GetLengthOffset ( ) const

Gets the length offset of this Character.

Returns
Returns a real representing the number of pixels to offset this from it's parent.

Definition at line 315 of file character.cpp.

Real Mezzanine::UI::Character::GetLineHeight ( ) const

Gets the height a line needs to be to support rendering this character.

Returns
Returns a Real representing how tall a TextLine needs to be to support this character in pixels.

Definition at line 155 of file character.cpp.

Vector2 Mezzanine::UI::Character::GetRelativeAtlasCoords ( const UI::QuadCorner  Corner) const

Gets the relative atlas coordinates of a quad corner.

Parameters
CornerThe corner to retrieve the coordinates for.
Returns
Returns a Vector2 containing the Atlas relative(0 to 1) position of the requested corner.

Definition at line 228 of file character.cpp.

const CharacterTraits & Mezzanine::UI::Character::GetTraits ( ) const

Gets this Characters sharable traits.

Returns
Returns a const reference to the sharable traits belonging to this Character.

Definition at line 268 of file character.cpp.

Real Mezzanine::UI::Character::GetUnscaledCharacterAdvance ( Glyph Prev) const

Gets the amount of pixels to advance the cursor after placing this character without scaling applied.

Parameters
PrevThe glyph prior to this one in the parent TextLine. Needed for kerning information.
Returns
Returns a Real representing the number of pixels to advance.

Definition at line 143 of file character.cpp.

Vector2 Mezzanine::UI::Character::GetUnscaledCharacterSize ( ) const

Gets the rendered size of this character without any scaling applied.

Returns
Returns a Vector2 containing the size this character is to be rendered at before scaling.

Definition at line 352 of file character.cpp.

Real Mezzanine::UI::Character::GetUnscaledLineHeight ( ) const

Gets the height a line needs to be to support rendering this character without scaling applied.

Returns
Returns a Real representing how tall a TextLine needs to be to support this character in pixels before scaling.

Definition at line 164 of file character.cpp.

Real Mezzanine::UI::Character::GetUnscaledVerticalOffset ( ) const

Gets the vertical adjustment for this character without scaling applied.

Returns
Returns a Real representing the position adjustment on the Y axis in pixels before scaling.
Todo:
If we want to change how normal text is aligned on the Y axis, we need to update this.

Definition at line 185 of file character.cpp.

Real Mezzanine::UI::Character::GetVerticalOffset ( ) const

Gets the vertical adjustment for this character.

Returns
Returns a Real representing the position adjustment on the Y axis in pixels.

Definition at line 176 of file character.cpp.

Boolean Mezzanine::UI::Character::IsCustomSizeSet ( ) const

Whether or not the custom size has been set.

Returns
Returns true if a custom size has been provided for this character, false if it is using it's default size.

Definition at line 328 of file character.cpp.

Boolean Mezzanine::UI::Character::IsGlyph ( ) const

Gets whether or not this character is a glyph.

Returns
Returns true if this character is a glyph, false otherwise.

Definition at line 273 of file character.cpp.

Boolean Mezzanine::UI::Character::IsHighlightable ( ) const

Gets if this character can be highlighted.

Returns
Returns true if this character can be highlighted, false otherwise.

Definition at line 289 of file character.cpp.

Boolean Mezzanine::UI::Character::IsNewLine ( ) const

Gets if this character is a line break character.

Returns
Returns true if this character indicates a new line, false otherwise.

Definition at line 301 of file character.cpp.

Boolean Mezzanine::UI::Character::IsRenderable ( ) const

Gets if this character contains valid data for rendering.

Returns
Returns true if this character can be rendered, false otherwise.

Definition at line 283 of file character.cpp.

Boolean Mezzanine::UI::Character::IsSprite ( ) const

Gets whether or not this character is a sprite.

Returns
Returns true if this character is a sprite, false otherwise.

Definition at line 278 of file character.cpp.

Boolean Mezzanine::UI::Character::IsWhiteSpace ( ) const

Gets if this character is a whitespace glyph.

Returns
Returns true if this character is a whitespace, false otherwise.

Definition at line 295 of file character.cpp.

void Mezzanine::UI::Character::SetCharacterColour ( const ColourValue Colour)

Sets the fill colour for this character.

Note
With most text/glyphs this will simply set the colour of the letters. In the case of sprites or special coloured text this will blend with the rendered colour giving a third result.
Parameters
ColourThe colour to render this character with.

Definition at line 235 of file character.cpp.

void Mezzanine::UI::Character::SetCustomSize ( const Vector2 Size)

Sets the custom size this character is to be resized to.

Remarks
The size set here is still subject to scaling from it's parent, and thus is not final.

The default for this value is (-1,-1), and this can be set at any time to revert to using the characters default size.
Parameters
SizeThe custom size to apply to this character in pixels.

Definition at line 320 of file character.cpp.

void Mezzanine::UI::Character::SetHighlighted ( Boolean  Highlight)

Sets whether or not this character should be highlighted.

Parameters
HighlightTrue to highlight this character, false to remove a highlight on it.

Definition at line 250 of file character.cpp.

void Mezzanine::UI::Character::SetLengthOffset ( const Real Offset)

Sets the offset from the position of the parent TextLine.

Warning
Adjusting this value manually can create visual artifacts. Only call this manually if you know what you are doing.
Parameters
OffsetThe placement offset from the parent's origin in pixels.

Definition at line 310 of file character.cpp.

void Mezzanine::UI::Character::SetTraits ( const CharacterTraits Traits)

Sets this Characters sharable traits.

Parameters
TraitsThe traits to be given to this Character.

Definition at line 260 of file character.cpp.

Member Data Documentation

Glyph* Mezzanine::UI::Character::CharGlyph
protected

A pointer to the Glyph this character is being rendered as, or NULL if it is a Sprite.

Definition at line 73 of file character.h.

Sprite* Mezzanine::UI::Character::CharSprite
protected

A pointer to the Sprite this character is being rendered as, or NULL if it is a Glyph.

Definition at line 76 of file character.h.

CharacterTraits Mezzanine::UI::Character::CharTraits
protected

The rendering traits of this character.

Definition at line 64 of file character.h.

Vector2 Mezzanine::UI::Character::CustomSize
protected

The forced size of this character, if it is set.

Definition at line 67 of file character.h.

Boolean Mezzanine::UI::Character::Highlighted
protected

Stores whether or not this character is being highlighted.

Definition at line 82 of file character.h.

TextLayer* Mezzanine::UI::Character::Layer
protected

A pointer to the layer this character is being rendered by.

Definition at line 70 of file character.h.

Real Mezzanine::UI::Character::LengthOffset
protected

The X-axis offset from the left side where this character is being rendered relative to the TextLine position.

Definition at line 79 of file character.h.


The documentation for this class was generated from the following files: