#include <PropaneFont.h>
Public Member Functions | |
| Font (const std::string &familyName) | |
| Constructor based on the shared family: "data/sharedfont" will load "data/sharedfont.png" and "data/sharedfont.fnt" with alpha keying on black (BMFont default). | |
| ~Font () | |
| Destructor. | |
| void | print (int x, int y, const std::string &text) |
| Standard print routine. Newlines are supported. | |
| void | rightAlignPrint (int x, int y, const std::string &text) |
| Printing right-aligned. Newlines are supported. | |
| void | centrePrint (int screen_width, int y, const std::string &text) |
| Printing centre-aligned. Newlines are supported. | |
| void | wordWrapPrint (int x, int y, int wrapPoint, const std::string &text) |
| Word wrapped printing. "wrapPoint" is the x-coordinate (in pixels) where we should wrap along. | |
| void | mathPrint (int x, int y, float offset, float step, float amplitude, float(*function)(float), const std::string &text) |
| Print using a mathematical function to order the y offset. Useful for cracktros (TODO). | |
| unsigned int | getLineHeight () |
| Get the height in pixels of a single line of text from this font. | |
| unsigned int | getWidthForString (const std::string &text) |
| Get the width in pixels of a single line of text from this font, cutting out colour codes and ignoring newlines. | |
| void | setFontColour (float r, float g, float b, float a=1.0f) |
| Sets the font colour. | |
| bool | ready () |
| Tells the end-user if the font successfully completed construction. | |
|
||||||||||||||||
|
Printing centre-aligned. Newlines are supported. Print text evenly centred around the middle of the screen Does not handle newline correctly, but will involve colour codes in the calculation (uses getWidthForString).
|
|
|
Get the height in pixels of a single line of text from this font. Returns the height, in pixels, of a single line of text using the current font.
|
|
|
Get the width in pixels of a single line of text from this font, cutting out colour codes and ignoring newlines. Returns the width, in pixels, of a string when printed out. Does not take newlines into effect.
|
|
||||||||||||||||
|
Standard print routine. Newlines are supported. Print a string to the screen, using this font. Cornerstone method of the entire Propane::Font class; most methods that print will call this. It will emit an error on stderr and then abort if the font has not been correctly loaded.
|
|
||||||||||||||||
|
Printing right-aligned. Newlines are supported. Print text so it is to the left of X. Does not handle newline properly. Uses getWidthForString.
|
|
||||||||||||||||||||
|
Sets the font colour. Sets the default font colour used for rendering. After using this function, all calls to print will print in that colour.
|
|
||||||||||||||||||||
|
Word wrapped printing. "wrapPoint" is the x-coordinate (in pixels) where we should wrap along. Prints a certain string at a certain location, left aligned. Will break every 'wrapPoint' pixels to a new line. Not guaranteed to handle inline colour state correctly across linebreaks. Will strip out multiple spaces, so "hello world" will appear as "hello world"
|
1.4.6