FreeBASIC  0.91.0
io_readxy.c
Go to the documentation of this file.
1 /* console SCREEN() function (cursor position query) */
2 
3 #include "../fb.h"
4 #include "fb_private_console.h"
5 
6 FBCALL unsigned int fb_ConsoleReadXY( int x, int y, int colorflag )
7 {
8  unsigned char *buffer;
9 
10  if( !__fb_con.inited )
11  return 0;
12 
13  BG_LOCK( );
15  BG_UNLOCK( );
16 
17  if ((x < 1) || (x > __fb_con.w) || (y < 1) || (y > __fb_con.h))
18  return 0;
19 
20  if (colorflag)
21  buffer = __fb_con.attr_buffer;
22  else
23  buffer = __fb_con.char_buffer;
24 
25  return (unsigned int)buffer[((y - 1) * __fb_con.w) + x - 1];
26 }