Class representing a bitmap font.
More...
#include <BmpFont.h>
|
| BmpFont (const std::string &path, char_t startCodepoint, char_t glyphWidth, char_t glyphHeight, char_t count) |
| Create a bitmap font. More...
|
|
void | setResMan (Resources *res) override |
| Does nothing, we don't need it. More...
|
|
void | setSize (unsigned int size) override |
| Does nothing, partly because bitmap fonts aren't meant to be scalable (and look like shit when they are), but also because the class's memory footprint would have to double in order to support scaling. More...
|
|
void | bindChar (char_t c) override |
| Binds the given codepoint's texture to the currently active OpenGL texture slot. More...
|
|
void | clearCache () override |
| Does nothing, as there's no cache.
|
|
int | getCharWidth () override |
| Gets the width of each codepoint. More...
|
|
int | getCharHeight () override |
| Gets the height of each codepoint. More...
|
|
|
typedef unsigned int | char_t |
| Codepoint type.
|
|
Class representing a bitmap font.
- See also
- Font
◆ BmpFont()
etm::BmpFont::BmpFont |
( |
const std::string & |
path, |
|
|
char_t |
startCodepoint, |
|
|
char_t |
glyphWidth, |
|
|
char_t |
glyphHeight, |
|
|
char_t |
count |
|
) |
| |
Create a bitmap font.
- Warning
- When created, will fill texture objects, binding itself to the current context. Make sure the desired context is current!
- Note
- The first glyph in the bitmap is interpreted as the null character - the char that will be displayed if the given codepoint is out of range.
-
Expects the given image to have only two channels (be black and white)
- Parameters
-
[in] | path | Path to the bitmap |
[in] | startCodepoint | The value of the starting codepoint. This will be the second glyph in the list, for previously stated reasons. |
[in] | glyphWidth | The pixel width of each glyph |
[in] | glyphHeight | The pixel height of each glyph |
[in] | count | The number of glyphs contained within the bitmap, not including the first "null" glyph. |
- Exceptions
-
std::invalid_argument | if the given path cannot be opened or decoded |
◆ bindChar()
void etm::BmpFont::bindChar |
( |
char_t |
c | ) |
|
|
overridevirtual |
Binds the given codepoint's texture to the currently active OpenGL texture slot.
- Parameters
-
[in] | c | The codepoint to bind |
Implements etm::EtmFont.
◆ getCharHeight()
int etm::BmpFont::getCharHeight |
( |
| ) |
|
|
overridevirtual |
Gets the height of each codepoint.
- Returns
- The height
- See also
- charHeight
Implements etm::EtmFont.
◆ getCharWidth()
int etm::BmpFont::getCharWidth |
( |
| ) |
|
|
overridevirtual |
Gets the width of each codepoint.
- Returns
- The width
- See also
- charWidth
Implements etm::EtmFont.
◆ setResMan()
void etm::BmpFont::setResMan |
( |
Resources * |
res | ) |
|
|
overridevirtual |
Does nothing, we don't need it.
- Parameters
-
Implements etm::EtmFont.
◆ setSize()
void etm::BmpFont::setSize |
( |
unsigned int |
size | ) |
|
|
overridevirtual |
Does nothing, partly because bitmap fonts aren't meant to be scalable (and look like shit when they are), but also because the class's memory footprint would have to double in order to support scaling.
- Parameters
-
Implements etm::EtmFont.
The documentation for this class was generated from the following file: