2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
#include <geos.h>
|
|
|
|
#include <conio.h>
|
2002-04-06 17:58:47 +00:00
|
|
|
#include <mouse.h>
|
2001-10-27 17:13:22 +00:00
|
|
|
|
2012-02-09 12:32:53 +00:00
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
struct mouse_info info;
|
|
|
|
char ch;
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
DlgBoxOk("Now the screen will be", "cleared.");
|
2022-04-17 14:06:45 +00:00
|
|
|
|
2001-10-27 17:13:22 +00:00
|
|
|
clrscr();
|
2022-04-17 14:06:45 +00:00
|
|
|
|
2001-10-27 17:13:22 +00:00
|
|
|
DlgBoxOk("Now a character will be", "written at 20,20");
|
2022-04-17 14:06:45 +00:00
|
|
|
|
2012-02-09 12:32:53 +00:00
|
|
|
gotoxy(20, 20);
|
2001-10-27 17:13:22 +00:00
|
|
|
cputc('A');
|
|
|
|
|
|
|
|
DlgBoxOk("Now a string will be", "written at 0,1");
|
2022-04-17 14:06:45 +00:00
|
|
|
|
2012-02-09 12:32:53 +00:00
|
|
|
cputsxy(0, 1, CBOLDON "Just" COUTLINEON "a " CITALICON "string." CPLAINTEXT );
|
2001-10-27 17:13:22 +00:00
|
|
|
|
|
|
|
DlgBoxOk("Write text and finish it", "with a dot.");
|
|
|
|
|
|
|
|
cursor(1);
|
|
|
|
do {
|
|
|
|
ch = cgetc();
|
2012-02-09 12:32:53 +00:00
|
|
|
cputc(ch);
|
2001-10-27 17:13:22 +00:00
|
|
|
} while (ch!='.');
|
2012-02-09 12:32:53 +00:00
|
|
|
cursor(0);
|
2001-10-27 17:13:22 +00:00
|
|
|
|
2002-04-06 17:58:47 +00:00
|
|
|
DlgBoxOk("Seems that it is all for conio.", "Let's test mouse routines.");
|
2022-04-17 14:06:45 +00:00
|
|
|
|
2002-04-06 17:58:47 +00:00
|
|
|
mouse_init(1);
|
2012-02-09 12:32:53 +00:00
|
|
|
cputsxy(0, 2, CBOLDON "Now you can't see mouse (press any key)" CPLAINTEXT);
|
2002-04-06 17:58:47 +00:00
|
|
|
mouse_hide();
|
|
|
|
while (!kbhit()) { };
|
|
|
|
cputc(cgetc());
|
2012-02-09 12:32:53 +00:00
|
|
|
|
|
|
|
cputsxy(0, 3, CBOLDON "Now you see the mouse (press any key)" CPLAINTEXT);
|
2002-04-06 17:58:47 +00:00
|
|
|
mouse_show();
|
|
|
|
while (!kbhit()) { };
|
|
|
|
cputc(cgetc());
|
|
|
|
|
2012-02-09 12:32:53 +00:00
|
|
|
// Get the current mouse coordinates and button states and print them
|
|
|
|
mouse_info(&info);
|
|
|
|
gotoxy(0, 4);
|
|
|
|
cprintf("X = %3d", info.pos.x);
|
|
|
|
gotoxy(0, 5);
|
|
|
|
cprintf("Y = %3d", info.pos.y);
|
|
|
|
gotoxy(0, 6);
|
|
|
|
cprintf("LB = %c", (info.buttons & MOUSE_BTN_LEFT)? '1' : '0');
|
|
|
|
gotoxy(0, 7);
|
|
|
|
cprintf("RB = %c", (info.buttons & MOUSE_BTN_RIGHT)? '1' : '0');
|
2002-04-06 17:58:47 +00:00
|
|
|
|
|
|
|
DlgBoxOk("Bye,", "Bye.");
|
2001-10-27 17:13:22 +00:00
|
|
|
}
|