OutTextXY Function

Microchip Graphics Library

Microchip Graphics Library
OutTextXY Function
C
WORD OutTextXY(
    SHORT x, 
    SHORT y, 
    XCHAR * textString
);
Overview

This function outputs a string of characters starting at the given x, y position. The string must be terminated by a line feed or zero. For Non-Blocking configuration, OutTextXY() may return control to the program due to display device busy status. When this happens zero is returned and OutTextXY() must be called again to continue the outputting of the string. For Blocking configuration, this function always returns a 1. OutTextXY() uses the current active font set with SetFont().

Input Parameters
Input Parameters 
Description 
SHORT x 
Defines the x starting position of the string. 
SHORT y 
Defines the y starting position of the string. 
XCHAR * textString 
Pointer to the string to be displayed. 
Returns

For NON-Blocking configuration:

  • Returns 0 when string is not yet outputted completely.
  • Returns 1 when string is outputted completely.
For Blocking configuration:
  • Always return 1.

Side Effects

Current horizontal graphic cursor position will be moved to the end of the text. The vertical graphic cursor position will not be changed.

Example
void PlaceText(void)
{
    SHORT width, height;
    static const XCHAR text[] = "Touch screen to continue";
    
    SetColor(BRIGHTRED);                // set color
    SetFont(pMyFont);                   // set font to my font
    
    // get string width & height
    width = GetTextWidth(text, pMyFont);
    height = GetTextHeight(pMyFont);
    
    // place string in the middle of the screen
    OutTextXY(  (GetMaxX() - width) >> 1, 
    (GetMaxY() – height) >> 1, 
    (char*)text);
}
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved