#include <tscope.h>
int main()
{
ts_debug(DEBUG0);
ts_scrsize(SIZE1);
ts_init();
ts_defkey(M1);
ts_defkey(M2);
ts_defkey(M3);
int space = ts_defkey(KEY_SPACE);
ts_printf(-XMAX + 20, YMAX - 40, "testmouse.c");
ts_printf(-XMAX + 20, YMAX - 50,
"When a keypress is detected the corresponding code will be highlighted");
ts_printf(-XMAX + 20, YMAX - 60, "Press space to exit");
ts_textmode(BLACK);
ts_drawmouse();
int i, r;
for (i = 1; i <= 3; i++)
ts_printf_centre(0 + i * 20 - 40, 0, "M%d", i);
do {
r = ts_respstatus();
if (r) {
for (i = 1; i <= 3; i++) {
if (i == r) {
ts_fgcolor(RED);
ts_printf_centre(0 + i * 20 - 40, 0, "M%d", i);
ts_wait(mtt(1000));
ts_fgcolor(WHITE);
ts_printf_centre(0 + i * 20 - 40, 0, "M%d", i);
}
}
}
ts_printf_centre(-ax(.5), -ay(.5), "X: %04d", ts_xmouse());
ts_printf_centre(ax(.5), -ay(.5), "Y: %04d", ts_ymouse());
} while (r != space);
return 0;
}
END_OF_MAIN();