All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
LxS::CoreGraphics::Font Class Reference

font - a piece of text actually (printed using particular font typeface) More...

#include <font.hpp>

Inheritance diagram for LxS::CoreGraphics::Font:
Inheritance graph
Collaboration diagram for LxS::CoreGraphics::Font:
Collaboration graph

Public Types

enum  Rendermode { ForReal, ForCoords3D, ForCoordsGame }
 purpose of rendering. ForReal is "to display", ForCoords3D is "to determine where user has clicked" More...

Public Member Functions

void SetFontFace (const std::string &_nface)
void Animate (float dt)
 move contents dt=delta time in seconds since last call to animate;
void Initialize ()
void Print (const char *text)
void EraseFromEnd (int n)
void SetFontColor (float _r, float _g, float _b)
 set font color
void Render (Rendermode mode)
 render a font
void UnloadResources ()
 free resources (textures etc if unused)
void SetXY (float x, float y)
void TranslateXY (float x, float y)
void SetHeight (float h)
 set text height in centimeters per line;
float GetHeight ()
 get height of a next character
void Clear ()
 erase all printed characters
unsigned long GetTexelsCount ()
 texture size ofc.
unsigned long GetFacesCount ()
 number of characters
float GetRightEdge ()
 rightmst X coordinate of text
float GetLeftEdge ()
 leftmost X coordinate of text
float GetTopEdge ()
 topmost Y coordinate of text
float GetBottomEdge ()
 downmost Y coordinate of text
float GetInitializedPercentage ()
 0= uninitialized; 100=ready; other? for progress bars
virtual void RefreshAssets ()
 To facilitate refreshing app after switching OpenGL Context (as in Android lifecycle)

Protected Attributes

float initialized_percentage
 0-100; 0- just constructed; 100 - redy to render; 0-100 - for progressbar

Detailed Description

font - a piece of text actually (printed using particular font typeface)

Member Enumeration Documentation

purpose of rendering. ForReal is "to display", ForCoords3D is "to determine where user has clicked"


proper rendering for display


rendering for coordinate detection


for detection of ingame coordinate system - unused

Member Function Documentation

void LxS::CoreGraphics::Font::EraseFromEnd ( int  n)

erase n last characters

namount of characters to be erased
void LxS::CoreGraphics::Font::Initialize ( )

set up a font face; if it is a first instance of Font class using particular typeface, it will be loaded from disk; otherwise it will be reused

Implements LxS::CoreGraphics::IRenderable.

void LxS::CoreGraphics::Font::Print ( const char *  text)

print particular text using a bitmap font (append to what was already written)

void LxS::CoreGraphics::Font::SetFontFace ( const std::string &  _nface)

set path to font-describing file all glyphs are rendered with the same font; text must be cleared before changing font; font name can be (and if you surely want undefault name, should be) set before initing

void LxS::CoreGraphics::Font::SetXY ( float  x,
float  y 

centimeters from bottom-left - set position at which new text will be appended

void LxS::CoreGraphics::Font::TranslateXY ( float  x,
float  y 

move ALL the contents of this object. This is constant-time function regardless of how many characters are there; good for GPU-assisted scrolling of heug text

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