$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <font.h>
font.cpp - The color fonts. | |
virtual | ~CFont () |
int | Height () const |
int | Width (const std::string &text) const |
int | Width (const int number) const |
bool | IsLoaded () const |
virtual void | drawString (gcn::Graphics *graphics, const std::string &text, int x, int y) |
void | Load () |
void | Reload () const |
void | FreeOpenGL () |
void | Clean () |
CGraphic * | GetFontColorGraphic (const CFontColor *fontColor) const |
template<bool CLIP> | |
unsigned int | DrawChar (CGraphic *g, int utf8, int x, int y, const CFontColor *fc) const |
void | DynamicLoad () const |
static CFont * | New (const std::string &ident, CGraphic *g) |
static CFont * | Get (const std::string &ident) |
Public Member Functions | |
virtual int | getHeight () const |
virtual int | getWidth (const std::string &text) const |
#include "font.h"
Defines the fonts used in the Stratagus engine. We support proportional multicolor fonts of 9 colors. (Currently the fonts aren't packed)
CFont::CharWidth[]
The width of each font glyph in pixels. The index 0 is the width of the SPACE (' ', 0x20).
CFont::G
Contains the graphics of the font, Only 9 colors are supported.
CFont::~CFont | ( | ) | [virtual] |
Create a new font
ident | Font identifier | |
g | Graphic |
CFont * CFont::Get | ( | const std::string & | ident | ) | [static] |
Get a font
ident | Font identifier |
int CFont::Height | ( | ) | const |
int CFont::Width | ( | const std::string & | text | ) | const |
Returns the pixel width of text.
text | Text to calculate the width of. |
int CFont::Width | ( | const int | number | ) | const |
Returns the pixel width of text.
text | Text to calculate the width of. |
bool CFont::IsLoaded | ( | ) | const |
virtual int CFont::getHeight | ( | ) | const [inline, virtual] |
Gets the height of the glyphs in the font.
Implements gcn::Font.
virtual int CFont::getWidth | ( | const std::string & | text | ) | const [inline, virtual] |
Gets the width of a string. The width of a string is not necesserily the sum of all the widths of it's glyphs.
text | the string to return the width of. |
Implements gcn::Font.
void CFont::drawString | ( | gcn::Graphics * | graphics, | |
const std::string & | text, | |||
int | x, | |||
int | y | |||
) | [virtual] |
Draws a string.
NOTE: You normally won't use this function to draw text since Graphics contains better functions for drawing text.
graphics | 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 gcn::Font.
void CFont::Load | ( | ) |
void CFont::Reload | ( | ) | const |
void CFont::FreeOpenGL | ( | ) |
void CFont::Clean | ( | ) |
CGraphic * CFont::GetFontColorGraphic | ( | const CFontColor * | fontColor | ) | const |
unsigned int CFont::DrawChar | ( | CGraphic * | g, | |
int | utf8, | |||
int | x, | |||
int | y, | |||
const CFontColor * | fc | |||
) | const [inline] |
void CFont::DynamicLoad | ( | ) | const |