Print data on the current screen.
int OkfPrint( unsigned char *pStr );
int OkfPrintAt( int x, int y, unsigned char *pStr );
int OkfPrintChar( unsigned char ch );
int OkfPrintCharAt( int x, int y, unsigned char ch );
int OkfPrintLong( long number, unsigned char *pFormat );
int OkfPrintLongAt( int x, int y, long number, unsigned char *pFormat );
Routine | Required Header |
OkfPrint | "okf.h" |
OkfPrintAt | "okf.h" |
OkfPrintChar | "okf.h" |
OkfPrintCharAt | "okf.h" |
OkfPrintLong | "okf.h" |
OkfPrintLongAt | "okf.h" |
Libraries
OKLIB.A | Oankali's GP32 run-time library |
Return Value
In case of success these printing functions return 0, otherwise these return -1. Look at okf.lastError for details on what happened.
Parameters
x
An integer value that indicates the horizontal coordinate where to print the data.
y
An integer value that indicates the vertical coordinate where to print the data.
pStr
A pointer to the string to be printed.
ch
The character to be printed.
number
The number to be printed.
pFormat
A pointer to the format string to use to format the number.
Remarks
These functions print the
desired data taking into account all the properties settled in okf (font,
justification, special effects, character and line separation, clipping area,
etc...).
If okf.background.opacity > 0, a background is also painted
taking into account the properties of the okf.background structure (see OkfPaintBackground
for more details).
OkfPrint, OkfPrintChar and OkfPrintLong uses the current cursor position to print the data. okf.x and okf.y are then automatically updated and point to the next printing position.
OkfPrintAt, OkfPrintCharAt and OkfPrintLongAt uses x and y as starting cursor position to print the data. okf.x and okf.y are then automatically updated and point to the next printing position.
When printing left justified text, there is no limit for the length of the string. For centred or right justified printing, the length of the string to be printed has to be < MAX_LINE.
When using OkfPrintLong or OkfPrintLongAt, the length of the resulting formatted string must be < OKF_MAXNUMBER.
"\n" sequences are interpreted as new line characters like in standard printf C function. Every time a new line character is found, okf.x is initialized to its starting position and okf.y is incremented by the height of the line (GetCurrentFont()->pOkf->defaultHeight + GetCurrentFont()->pOkf->lineSeparation + okf.lineSeparation). Therefore if a new line character is added at the end of a string, okf.x remains unchanged at the end of the function.
Example
|
See Also
OKF Font Engine Routines, OKF Font Engine Constants, OkfPaintBackground