HoverRace  2.0
Public Member Functions | Protected Attributes | List of all members
HoverRace::Display::TypeCase Class Referenceabstract

Character-by-character text renderer. More...

#include <TypeCase.h>

+ Inheritance diagram for HoverRace::Display::TypeCase:

Public Member Functions

 TypeCase (const UiFont &font, int width, int height)
 Constructor. More...
 
 TypeCase (const TypeCase &)=delete
 
virtual ~TypeCase ()
 
virtual MR_UInt32 CountTextures () const =0
 Count the number of active backing textures. More...
 
int GetHeight () const
 Retrieve the height of each of the backing textures. More...
 
int GetWidth () const
 Retrieve the width of each of the backing textures. More...
 
TypeCaseoperator= (const TypeCase &)=delete
 
virtual void Prepare (const std::string &s, TypeLine *rects=nullptr)=0
 Prepare a string to be rendered. More...
 
virtual void Render (const TypeLine &s, const Color color, int x, int y, boost::optional< size_t > caret={})=0
 Render a string. More...
 
virtual void RenderTexture (MR_UInt32 idx, int x, int y, double scale=1.0)=0
 Renders the backing texture (for debugging purposes). More...
 

Protected Attributes

const UiFont font
 
const int height
 
const int width
 

Detailed Description

Character-by-character text renderer.

Author
Michael Imamura

Constructor & Destructor Documentation

HoverRace::Display::TypeCase::TypeCase ( const UiFont font,
int  width,
int  height 
)
inline

Constructor.

Parameters
fontThe font.
widthThe width of the backing texture.
heightThe height of the backing texture.
HoverRace::Display::TypeCase::TypeCase ( const TypeCase )
delete
virtual HoverRace::Display::TypeCase::~TypeCase ( )
inlinevirtual

Member Function Documentation

virtual MR_UInt32 HoverRace::Display::TypeCase::CountTextures ( ) const
pure virtual

Count the number of active backing textures.

Returns
The total number of textures (may be zero).

Implemented in HoverRace::Display::SDL::SdlTypeCase.

int HoverRace::Display::TypeCase::GetHeight ( ) const
inline

Retrieve the height of each of the backing textures.

Returns
The height, in pixels.
int HoverRace::Display::TypeCase::GetWidth ( ) const
inline

Retrieve the width of each of the backing textures.

Returns
The width, in pixels.
TypeCase& HoverRace::Display::TypeCase::operator= ( const TypeCase )
delete
virtual void HoverRace::Display::TypeCase::Prepare ( const std::string &  s,
TypeLine rects = nullptr 
)
pure virtual

Prepare a string to be rendered.

If rects is omitted, then this can be used to preemptively add characters to the type case before they are used later.

Parameters
sThe text string that will be rendered.
[out]rectsOptional destination buffer for the prepared text.

Implemented in HoverRace::Display::SDL::SdlTypeCase.

virtual void HoverRace::Display::TypeCase::Render ( const TypeLine s,
const Color  color,
int  x,
int  y,
boost::optional< size_t >  caret = {} 
)
pure virtual

Render a string.

Only characters which have been previously added via AddChars() will be rendered.

Parameters
sThe string to render.
colorThe color of the string.
xThe screen X coordinate of the upper-left corner.
yThe screen Y coordinate of the upper-left corner.
caretThe optional caret position.

Implemented in HoverRace::Display::SDL::SdlTypeCase.

virtual void HoverRace::Display::TypeCase::RenderTexture ( MR_UInt32  idx,
int  x,
int  y,
double  scale = 1.0 
)
pure virtual

Renders the backing texture (for debugging purposes).

Parameters
idxThe texture index.
xThe x coordinate.
yThe y coordinate.
scaleThe scaling factor.

Implemented in HoverRace::Display::SDL::SdlTypeCase.

Member Data Documentation

const UiFont HoverRace::Display::TypeCase::font
protected
const int HoverRace::Display::TypeCase::height
protected
const int HoverRace::Display::TypeCase::width
protected

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