IMS2
Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
|
Public Member Functions | |
GUI_font (int height, string face, bool proportional, int _id, GUI_COLOR _color, GUI_COLOR _bgcolor, GUI_COLOR _hilightcolor=GUI_COLOR(0, 0, 0), GUI_COLOR _hilightbg=GUI_COLOR(0, 0, 0), FontStyle style=FONT_NORMAL) | |
Creates a new font. More... | |
void | Print (SURFHANDLE tgt, std::string &text, int _x, int _y, RECT &elementPos, bool highlight=false, GUI_TEXT_POS tpos=T_LEFT, GUI_TEXT_VERTICAL_POS vpos=V_TOP) |
Prints a string to the target surface at the desired coordinates. More... | |
int | GetId () |
int | GetfHeight () |
int | GetfWidth () |
int | GetTextWidth (string &text) |
Private Member Functions | |
void | createFont (Font *font) |
Allocates a texture surface and prerenders the font to it using a sketchpad. | |
Private Attributes | |
int | id |
The id of this font. | |
int | fheight |
height of a symbol (font size) | |
int | fwidth |
average width of a symbol | |
int | width |
Entire width of the texture used to prerender the font. | |
SURFHANDLE | src |
source surface with the prerendered font | |
bool | hasHighlightFont |
whether or not this font has a variant for highlights | |
GUI_COLOR | color |
The default color of this font. | |
GUI_COLOR | bgcolor |
The default background color (the color the font is drawn on, since we don't have transparency) | |
GUI_COLOR | hilightcolor |
The color of this font if the text is hilighted. | |
GUI_COLOR | hilightbg |
The background color to draw the hilighted font on. | |
int | charpos [94] |
stores character positions in the bitmap for non-monotype fonts | |
font class to handle text output
GUI_font::GUI_font | ( | int | height, |
string | face, | ||
bool | proportional, | ||
int | _id, | ||
GUI_COLOR | _color, | ||
GUI_COLOR | _bgcolor, | ||
GUI_COLOR | _hilightcolor = GUI_COLOR(0, 0, 0) , |
||
GUI_COLOR | _hilightbg = GUI_COLOR(0,0,0) , |
||
FontStyle | style = FONT_NORMAL |
||
) |
Creates a new font.
height | The desired font height (size) in pixel |
face | The typeface name of the font (e.g. "Arial") |
proportional | Flag for proportional/fixed pitch font (not sure what that means, it's a sketchpad option) |
_id | identifier for this font |
_color | The text color of the font |
_bgcolor | The color of the background the font is drawn on (as we can't do color key blitting!) |
_hilightcolor | An alternate color in which the font should appear when hilighted. if not defined, no hilight font will be created |
_hilightbg | An alternate background color for the highlighted font. If undefined, the normal background color will be used |
style | font decoration style (bold, italic, underlined etc) |
int GUI_font::GetfHeight | ( | ) |
|
inline |
int GUI_font::GetId | ( | ) |
int GUI_font::GetTextWidth | ( | string & | text | ) |
void GUI_font::Print | ( | SURFHANDLE | tgt, |
std::string & | text, | ||
int | _x, | ||
int | _y, | ||
RECT & | elementPos, | ||
bool | highlight = false , |
||
GUI_TEXT_POS | tpos = T_LEFT , |
||
GUI_TEXT_VERTICAL_POS | vpos = V_TOP |
||
) |
Prints a string to the target surface at the desired coordinates.
where exactly the text is printed depends on tpos and vpos.
tgt | The SURFHANDLE to draw the text on |
text | Reference to a string containing the text to be drawn |
_x | x coordinate relative to the target surface. Exact interpretation depends on tpos |
_y | y coordinate relative to the target surface Exact interpretation depends on vpos |
elementPos | A clipping rect. Any text falling outside of this rectangle won't be drawn. |
highlight | If true, the text will be printed using the highlighted font |
tpos | Text justification. can either be T_LEFT, T_RIGHT or T_CENTER |
vpos | Vertical alignement of the text. can either be V_TOP, V_BOTTOM or V_CENTER |