1
2 #include <geos.h>
3 #include <conio.h>
4 #include <mouse.h>
5
main(void)6 void main(void)
7 {
8 struct mouse_info info;
9 char ch;
10
11 DlgBoxOk("Now the screen will be", "cleared.");
12
13 clrscr();
14
15 DlgBoxOk("Now a character will be", "written at 20,20");
16
17 gotoxy(20, 20);
18 cputc('A');
19
20 DlgBoxOk("Now a string will be", "written at 0,1");
21
22 cputsxy(0, 1, CBOLDON "Just" COUTLINEON "a " CITALICON "string." CPLAINTEXT );
23
24 DlgBoxOk("Write text and finish it", "with a dot.");
25
26 cursor(1);
27 do {
28 ch = cgetc();
29 cputc(ch);
30 } while (ch!='.');
31 cursor(0);
32
33 DlgBoxOk("Seems that it is all for conio.", "Let's test mouse routines.");
34
35 mouse_init(1);
36 cputsxy(0, 2, CBOLDON "Now you can't see mouse (press any key)" CPLAINTEXT);
37 mouse_hide();
38 while (!kbhit()) { };
39 cputc(cgetc());
40
41 cputsxy(0, 3, CBOLDON "Now you see the mouse (press any key)" CPLAINTEXT);
42 mouse_show();
43 while (!kbhit()) { };
44 cputc(cgetc());
45
46 // Get the current mouse coordinates and button states and print them
47 mouse_info(&info);
48 gotoxy(0, 4);
49 cprintf("X = %3d", info.pos.x);
50 gotoxy(0, 5);
51 cprintf("Y = %3d", info.pos.y);
52 gotoxy(0, 6);
53 cprintf("LB = %c", (info.buttons & MOUSE_BTN_LEFT)? '1' : '0');
54 gotoxy(0, 7);
55 cprintf("RB = %c", (info.buttons & MOUSE_BTN_RIGHT)? '1' : '0');
56
57 DlgBoxOk("Bye,", "Bye.");
58 }
59