|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <font.hpp>
Public Member Functions | |
| virtual void | drawString (Graphics *graphics, std::string const &text, int x, int y)=0 |
| Font (Font &&)=default | |
| Font (Font const &)=default | |
| virtual int | getHeight () const =0 |
| virtual int | getStringIndexAt (std::string const &text, int x) const |
| virtual int | getWidth (std::string const &text) const =0 |
| Font & | operator= (Font &&)=default |
| Font & | operator= (Font const &)=default |
|
pure virtual |
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. |
Implemented in fcn::DefaultFont, fcn::ImageFont, and fcn::sdl2::TrueTypeFont.
|
pure virtual |
Gets the height of the glyphs in the font.
Implemented in fcn::DefaultFont, fcn::ImageFont, and fcn::sdl2::TrueTypeFont.
References getStringIndexAt().
Referenced by fcn::DropDown::adjustHeight(), fcn::Button::adjustSizeImpl(), fcn::CheckBox::adjustSizeImpl(), fcn::Button::draw(), fcn::CheckBox::draw(), fcn::ImageButton::draw(), fcn::Label::draw(), fcn::Window::draw(), fcn::Text::getCaretDimension(), fcn::Text::getCaretY(), fcn::Text::getDimension(), fcn::ListBox::getRowHeight(), fcn::TextBox::keyPressed(), and fcn::Text::setCaretPosition().
|
virtual |
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 in fcn::DefaultFont, and fcn::ImageFont.
Definition at line 11 of file font.cpp.
References getWidth().
Referenced by getHeight(), and fcn::Text::setCaretPosition().
|
pure virtual |
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. |
Implemented in fcn::DefaultFont, fcn::ImageFont, and fcn::sdl2::TrueTypeFont.
Referenced by fcn::Button::adjustSizeImpl(), fcn::CheckBox::adjustSizeImpl(), fcn::Text::getCaretDimension(), fcn::Text::getCaretX(), fcn::Text::getDimension(), and getStringIndexAt().