#include #include #include "metawndo.h" main() { int cx, cy; int mx, my; int level, buttons; long count = 0; char input; char buf[80]; InitGraphics (VGA640x480); SetDisplay (GrafPg0); InitMouse (MsDriver); ShowCursor(); MoveCursor (10, 10); TrackCursor (True); while (True) { input = NULL; QueryCursor (&cx, &cy, &level, &buttons); ReadMouse (&mx, &my, &buttons); sprintf (buf, "The cursor is at %d, %d ", cx, cy); MoveTo (10, 100); DrawString (buf); sprintf (buf, "The mouse is at %d, %d ", mx, my); MoveTo (10, 130); DrawString (buf); if (kbhit()) { input = getch(); if (input == 'q') break; TrackCursor (False); switch (input) { case 'r': MoveCursor ( cx+10, cy ); break; case 'l': MoveCursor ( cx-10, cy ); break; case 'd': MoveCursor (cx, cy+10); break; case 'u': MoveCursor (cx, cy-10); break; default: break; } TrackCursor (True); } }; getch(); StopMouse (); SetDisplay (TextPg0); StopGraphics(); printf ( "The cursor ended at %d x, %d y\n\n", cx, cy); printf ( "The mouse ended at %d x, %d y\n\n", mx, my); exit (0); }