Difference between revisions of "PrintMiniFix"
From WikiPrizm
Jump to navigationJump to searchLine 3: | Line 3: | ||
=== Definition === | === Definition === | ||
− | <nowiki>int PrintMiniFix( int x, int y, const char*Msg, const int flags, const short color, const short bcolor ){ | + | <nowiki>static const short empty[18] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
− | int i = 0, dx; | + | int PrintMiniFix(int x, int y, const char *Msg, const int flags, const short color, const short bcolor){ |
− | unsigned short width; | + | int i = 0, dx; |
− | void*p; | + | unsigned short width; |
+ | void *p; | ||
− | while ( Msg[ i ] ){ | + | while ( Msg[i] ){ |
− | p = GetMiniGlyphPtr( Msg[ i ], &width ); | + | p = GetMiniGlyphPtr( Msg[i], &width ); |
dx = ( 12 - width ) / 2; | dx = ( 12 - width ) / 2; | ||
if ( dx > 0 ) { | if ( dx > 0 ) { | ||
Line 22: | Line 23: | ||
} | } | ||
return x; | return x; | ||
− | } | + | }</nowiki> |
− | |||
=== Inputs === | === Inputs === |
Revision as of 13:27, 30 June 2012
Synopsis
This is a routine that displays a text in small (glyph) font on the screen.
Definition
static const short empty[18] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int PrintMiniFix(int x, int y, const char *Msg, const int flags, const short color, const short bcolor){ int i = 0, dx; unsigned short width; void *p; while ( Msg[i] ){ p = GetMiniGlyphPtr( Msg[i], &width ); dx = ( 12 - width ) / 2; if ( dx > 0 ) { PrintMiniGlyph( x, y, (void*)empty, flags, dx, 0, 0, 0, 0, color, bcolor, 0 ); }else dx = 0; PrintMiniGlyph( x+dx, y, p, flags, width, 0, 0, 0, 0, color, bcolor, 0 ); if ( width+dx < 12 ){ PrintMiniGlyph( x+width+dx, y, (void*)empty, flags, 12-width-dx, 0, 0, 0, 0, color, bcolor, 0 ); } x += 12; i++; } return x; }
Inputs
- int x: X-coordinate of top-left of text
- int y: Y-coordinate of top-left of text
- const char* Msg: string to display
- const int flags:
Symbol | Value |
---|---|
PMF_ALLOW_STATUSAREA | 0x40 |
PMF_INVERT | 4 |
PMF_DO_NOT_USE_BACKCOLOR | 2 |
PMF_UPPER_X_LIMIT_IGNORED | 0xFFFFFFFF |
- const short color: Text foreground color
- const short bcolor: Text background color
Outputs
Small font string on-screen.
Comments
Flags come from an old version of disp_tools.hpp. No further information on them is known.
Usage Example
PrintMiniFix(0, 175, "Oh look a string at the bottom of the screen.", 0, COLOR_WHITE, COLOR_BLACK);