Gamedev Framework (gf)  0.11.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::BitmapConsoleFont Class Reference

A bitmap console font. More...

#include <gf/ConsoleFont.h>

Inheritance diagram for gf::BitmapConsoleFont:
Inheritance graph
[legend]

Public Member Functions

virtual const BareTexturegetTexture () const override
 Get the texture of the console font. More...
 
bool loadFromFile (const Path &filename, ConsoleFontFormat format, Vector2u size={ 0u, 0u })
 Load a console font from a file. More...
 
- Public Member Functions inherited from gf::ConsoleFont
 ConsoleFont ()
 Constructor. More...
 
virtual ~ConsoleFont ()
 Destructor. More...
 
ConsoleFontFormat getFormat () const
 Get the format of the font. More...
 
Vector2u getSize () const
 Get the size of the fonts. More...
 
Vector2u getCharacterSize () const
 Get the size of the characters. More...
 
void mapCode (char16_t c, Vector2u position)
 Map a character to a position in the font. More...
 
void mapCodeRange (char16_t c, unsigned count, Vector2u position)
 Map a range of characters to consecutive positions in the font. More...
 
void mapString (StringRef str, Vector2u position)
 Map characters from a string to consecutive positions in the font. More...
 
void mapElement (ConsoleFontElement element)
 Map an element in the font. More...
 
void mapElements (ArrayRef< ConsoleFontElement > elements)
 Map some elements in the font. More...
 
void clearMapping ()
 Clear the mapping. More...
 
RectU getSubTexture (char16_t c) const
 Get the sub-texture rectangle. More...
 
RectF getTextureRect (char16_t c) const
 Get the texture rectangle for a character. More...
 

Additional Inherited Members

- Protected Member Functions inherited from gf::ConsoleFont
bool setFormatAndComputeSizes (ConsoleFontFormat format, Vector2u size, Vector2u imageSize)
 Set the format of the font. More...
 
void logFormat (const Path &filename) const
 Print the format of the font. More...
 
Vector2u getColorKeyPosition () const
 Get the color key position. More...
 

Detailed Description

A bitmap console font.

This class is based on libtcod console font handling. It supports bitmap fonts provided by libtcod.

See also
gf::ConsoleFont

Member Function Documentation

◆ getTexture()

virtual const BareTexture* gf::BitmapConsoleFont::getTexture ( ) const
overridevirtual

Get the texture of the console font.

Returns
The texture of the font

Implements gf::ConsoleFont.

◆ loadFromFile()

bool gf::BitmapConsoleFont::loadFromFile ( const Path filename,
ConsoleFontFormat  format,
Vector2u  size = { 0u, 0u } 
)

Load a console font from a file.

Parameters
filenameThe name of the file
formatThe format of the font
sizeThe size, in characters, of the font
Returns
True if the font was correctly loaded