C Language Development Kit/Functions/WhereY
From OptiWiki
< C Language Development Kit | Functions(Redirected from C Language Development Kit/Functions/Wherey)
| Description | This function returns the Y-coordinate of the current cursor position. | |||||||||||||||||||||||||||||||||||||||
| Syntax | int wherey(void); | |||||||||||||||||||||||||||||||||||||||
| Arguments | None | |||||||||||||||||||||||||||||||||||||||
| Returns | An integer value representing the current Y-coordinate of the cursor position. | |||||||||||||||||||||||||||||||||||||||
| Remarks | The coordinates of the top left corner of the display are (0,0).
The coordinates of the bottom right corner when using a system font are:
| |||||||||||||||||||||||||||||||||||||||
| Example | #include "lib.h" #include <stdio.h> #ifdef DWT #define MAXY1 #elif OPH #define MAXY7 #else #define MAXY3 #endif 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'); while( 1 ) { if( getchar() == ENT_KEY) { sound( TSTANDARD, VMEDIUM, SHIGH, 0); Move(); } } } |
