41 #ifndef _uicharacter_cpp
42 #define _uicharacter_cpp
44 #include "UI/character.h"
45 #include "UI/textlayer.h"
47 #include "MathTools/mathtools.h"
75 CharGlyph(CharacterGlyph),
88 CharGlyph(CharacterGlyph),
105 CharSprite(CharacterSprite),
118 CharSprite(CharacterSprite),
354 MathTools::Floor( Ret.
X );
355 MathTools::Floor( Ret.
Y );
Real GetHeight() const
Gets the sprite's height on the Atlas texture.
Real GetUnscaledVerticalOffset() const
Gets the vertical adjustment for this character without scaling applied.
Boole Highlighted
Stores whether or not this character is being highlighted.
Real GetWidth() const
Gets the sprite's width on the Atlas texture.
const CharacterTraits & GetTraits() const
Gets this Characters sharable traits.
bool IsWhitespace() const
Checks if this glyph is not renderable.
Real GetLineHeight() const
Gets the height of a line of text in this font.
bool Boole
Generally acts a single bit, true or false.
const String & GetAtlasName() const
Gets the name of the atlas this glyph belongs to.
Real LengthOffset
The X-axis offset from the left side where this character is being rendered relative to the TextLine ...
Class used to describe a single glyph or character available for text operations. ...
Boole IsWhiteSpace() const
Gets if this character is a whitespace glyph.
void SetTraits(const CharacterTraits &Traits)
Sets this Characters sharable traits.
Sprite * GetCharSprite() const
Gets the sprite being rendered by this character.
Vector2 GetUnscaledCharacterSize() const
Gets the rendered size of this character without any scaling applied.
Vector2 GetSize() const
Gets the size of the glyph on the Texture.
Boole IsHighlightable() const
Gets if this character can be highlighted.
Real GetRightEdgeLengthOffset() const
Gets the length offset of this Characters right side from its parent TextLine.
QuadCorner
Used by Sprites and Glyphs for tracking their placement on a TextureAtlas.
Boole IsCustomSizeSet() const
Whether or not the custom size has been set.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Boole IsRenderable() const
Gets if this character contains valid data for rendering.
Vector2 GetRelativeAtlasCoords(const UI::QuadCorner Corner) const
Gets the relative atlas coordinates of a quad corner.
static ColourValue White()
Creates a ColourValue representing the colour White.
Real GetLengthOffset() const
Gets the length offset of this Character from it's parent TextLine.
TextureAtlas * GetAtlas() const
Gets the atlas this character is using for rendering.
This is a collection of smaller textures packed into a larger texture, intended to increase UI perfor...
Glyph * CharGlyph
A pointer to the Glyph this character is being rendered as, or NULL if it is a Sprite.
Vector2 GetCharacterSize() const
Gets the rendered size of this character.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
virtual void _MarkDirty()
Marks this renderable as well as all parent objects as dirty.
This class stores common data for determining the look of a Character.
Real GetVerticalOffset() const
Gets the vertical adjustment for this character.
TextureAtlas * Atlas
The TextureAtlas this sprite belongs to.
FontData * CharFont
The font this Character belongs to.
Real GetUnscaledLineHeight() const
Gets the height a line needs to be to support rendering this character without scaling applied...
Boole IsNewLine() const
Gets if this character is a line break character.
Sprite * CharSprite
A pointer to the Sprite this character is being rendered as, or NULL if it is a Glyph.
Real VerticalOffset
The amount of pixels the glyph is to be adjusted on the Y axis.
Real GlyphAdvance
The number of pixels to advance the cursor for the next glyph.
float Real
A Datatype used to represent a real floating point number.
Character(const UInt32 &GlyphID, const CharacterTraits &Traits, TextLayer *Creator)
GlyphID Constructor.
Vector2 GetAtlasCoords(const UI::QuadCorner Corner) const
Gets the pixel position on the Atlas of a corner belonging to this Sprite.
Vector2 GetAtlasWhitePixel() const
Gets the coordinates to the white pixel on the atlas this character belongs to.
Real GetCharacterAdvance(Glyph *Prev) const
Gets the amount of pixels to advance the cursor after placing this character.
Real Y
Coordinate on the Y vector.
void SetHighlighted(Boole Highlight)
Sets whether or not this character should be highlighted.
bool IsNewLine() const
Checks if this glyph marks a new line.
FontData * Font
The collection of glyphs this glyph belongs to.
Real X
Coordinate on the X vector.
uint32_t UInt32
An 32-bit unsigned integer.
This is used to represent a point on a 2 dimentional area, such as a screen.
Boole GetHighlighted() const
Gets if this character is being highlighted.
Vector2 CustomSize
The forced size of this character, if it is set.
virtual Real GetDesiredLineHeight() const
Gets the height in pixels this layer is configured to render it's text.
TextLayer * Layer
A pointer to the layer this character is being rendered by.
Boole IsSprite() const
Gets whether or not this character is a sprite.
String GetAtlasName() const
Gets the name of the atlas this character is using for rendering.
void SetCharacterColour(const ColourValue &Colour)
Sets the fill colour for this character.
Vector2 GetAtlasCoords(const UI::QuadCorner Corner) const
Gets the atlas coordinates of a quad corner.
const ColourValue & GetCharacterColour() const
Gets the fill colour of this character.
Vector2 GetRelativeAtlasCoords(const UI::QuadCorner Corner) const
Gets the relative position on the Atlas of a corner belonging to this Sprite.
Real GetUnscaledCharacterAdvance(Glyph *Prev) const
Gets the amount of pixels to advance the cursor after placing this character without scaling applied...
TextureAtlas * Atlas
The TextureAtlas this glyph belongs to.
Thrown when parameters are checked at runtime and found invalid.
Real GetLineHeight() const
Gets the height a line needs to be to support rendering this character.
void SetLengthOffset(const Real &Offset)
Sets the offset from the position of the parent TextLine.
virtual const Vector2 & GetManualTextScale() const
Gets the scaling currently being applied to the rendered text.
ColourValue CharColour
The colour to render this Character as.
Real GetKerning(const UInt32 Previous) const
Convenience function for getting the Kerning information for a given Glyph.
Glyph * GetCharGlyph() const
Gets the glyph being rendered by this character.
The bulk of the engine components go in this namspace.
void SetCustomSize(const Vector2 &Size)
Sets the custom size this character is to be resized to.
Boole IsGlyph() const
Gets whether or not this character is a glyph.
Vector2 GetWhitePixel() const
Gets the location of the WhitePixel on the TextureAtlas.
Vector2 GetRelativeAtlasCoords(const UI::QuadCorner Corner) const
Gets the relative position on the Atlas of a corner belonging to this glyph.
CharacterTraits CharTraits
The rendering traits of this character.
Basic class used to describe a portion of a texture to be applied to a Quad.
std::string String
A datatype used to a series of characters.
This is a base class for render layers that render text.
Vector2 GetSize() const
Gets the size of the sprite on the Atlas texture.
const String & GetAtlasName() const
Gets the name of the atlas this sprite belongs to.
UInt32 GlyphID
The Character this glyph information represents.
Glyph * GetGlyph(const UInt32 &GlyphID) const
Gets the glyph corresponding to the provided characters UTF-8 code.
Vector2 GetAtlasCoords(const UI::QuadCorner Corner) const
Gets the pixel position on the Atlas of a corner belonging to this glyph.