This function returns the Y-coordinate of the current cursor position.

Syntax

int WhereY(void);

Parameters

None

Return value

Returns the current Y coordinate of the cursor position.

Remarks

The coordinates of the top left corner of the display are (0,0). For information on the max value of this function.
YMax
TINY_FONT_Y_MAX 26
SMALL_FONT_Y_MAX 20
MEDIUM_FONT_Y_MAX 13
LARGE_FONT_Y_MAX 10
HUGE_FONT_Y_MAX 6

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

#define MAXY 7 
void Move(void)
{
    int x, y;
    // Move the 'X" one place down and two places to the right.
    x=WhereX();
    y=WhereY();
    PrintSymbol(' ');
    x+=2;
    if (x > 15)
        x = 0;
    if (++y > MAXY)
        y = 0;
    GotoXY(x, y);
    PrintSymbol('X');
}
void main(void)
{
    Cursor(OFF);
    PrintSymbol('X');
    for(;;)
    {
        switch (getchar())
        {
        case TRIGGER_KEY:
            Sound(TSTANDARD,VMEDIUM,SHIGH,0);
            Move();
            break;
        case ENT_KEY:
            return;
        default:
            break;
        }
    }
}

Last updated: 2020/10/02