|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <defaultfont.hpp>
Public Member Functions | |
| virtual int | drawGlyph (Graphics *graphics, unsigned char glyph, int x, int y) |
| void | drawString (Graphics *graphics, std::string const &text, int x, int y) override |
| int | getHeight () const override |
| int | getStringIndexAt (std::string const &text, int x) const override |
| int | getWidth (std::string const &text) const override |
| Public Member Functions inherited from fcn::Font | |
| Font (Font &&)=default | |
| Font (Font const &)=default | |
| Font & | operator= (Font &&)=default |
| Font & | operator= (Font const &)=default |
A basic font implementation capable only of drawing rectangles (placeholder).
This font is used as a default font when no other font is specified.
Definition at line 22 of file defaultfont.hpp.
|
virtual |
Draws a glyph as a rectangle.
The glyphs will always be drawn as rectangles no matter the glyph.
NOTE: You normally won't use this function to draw text since the Graphics class contains better functions for drawing text.
| Graphics & Rendering | A Graphics object to be used for drawing. |
| glyph | The glyph to draw. |
| x | The x coordinate where to draw the glyph. |
| y | The y coordinate where to draw the glyph. |
Definition at line 23 of file defaultfont.cpp.
References fcn::Graphics::drawRectangle().
Referenced by drawString().
|
overridevirtual |
Draws a string.
NOTE: You normally won't use this function to draw text since Graphics contains better functions for drawing text.
| Graphics & Rendering | A Graphics object to use for drawing. |
| text | The string to draw. |
| x | The x coordinate where to draw the string. |
| y | The y coordinate where to draw the string. |
Implements fcn::Font.
Definition at line 32 of file defaultfont.cpp.
References drawGlyph(), and getWidth().
|
overridevirtual |
Gets the height of the glyphs in the font.
Implements fcn::Font.
Definition at line 13 of file defaultfont.cpp.
|
overridevirtual |
Gets a string index in a string providing an x coordinate.
Used to retrieve a string index (for a character in a string) at a certain x position. It is especially useful when a mouse clicks in a TextField and you want to know which character was clicked.
Reimplemented from fcn::Font.
Definition at line 41 of file defaultfont.cpp.
References getWidth().
|
overridevirtual |
Gets the width of a string.
The width of a string is not necessarily the sum of all the widths of it's glyphs.
| text | The string to return the width of. |
Implements fcn::Font.
Definition at line 18 of file defaultfont.cpp.
Referenced by drawString(), and getStringIndexAt().