Gamedev Framework (gf)  0.17.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

 BitmapConsoleFont (const Image &image, ConsoleFontFormat format, Vector2i size={ 0u, 0u })
 Load a console font from an image. More...
 
 BitmapConsoleFont (const Path &filename, ConsoleFontFormat format, Vector2i size={ 0u, 0u })
 Load a console font from a file. More...
 
const BareTexturegetTexture () const override
 Get the texture of the console font. More...
 
- Public Member Functions inherited from gf::ConsoleFont
 ConsoleFont ()
 Constructor. More...
 
 ConsoleFont (const Image &image, ConsoleFontFormat format, Vector2i size)
 Constructor. More...
 
virtual ~ConsoleFont ()
 Destructor. More...
 
ConsoleFontFormat getFormat () const
 Get the format of the font. More...
 
Vector2i getSize () const
 Get the size of the fonts. More...
 
Vector2i getCharacterSize () const
 Get the size of the characters. More...
 
void mapCode (char16_t c, Vector2i position)
 Map a character to a position in the font. More...
 
void mapCodeRange (char16_t c, int count, Vector2i position)
 Map a range of characters to consecutive positions in the font. More...
 
void mapString (StringRef str, Vector2i 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...
 
RectI 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
void logFormat (const Path &filename) const
 Print the format of the font. More...
 
Vector2i 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

Constructor & Destructor Documentation

◆ BitmapConsoleFont() [1/2]

gf::BitmapConsoleFont::BitmapConsoleFont ( const Image image,
ConsoleFontFormat  format,
Vector2i  size = { 0u, 0u } 
)

Load a console font from an image.

Parameters
imageThe image used by the font
formatThe format of the font
sizeThe size, in characters, of the font

◆ BitmapConsoleFont() [2/2]

gf::BitmapConsoleFont::BitmapConsoleFont ( const Path filename,
ConsoleFontFormat  format,
Vector2i  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

Member Function Documentation

◆ getTexture()

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

Get the texture of the console font.

Returns
The texture of the font

Implements gf::ConsoleFont.