I wanted to write a program using Kempston Mouse.
Code: Select all
/* zcc +zxansi -vn -lndos -create-app -o kemp.bin kemp.c */
#include <input.h>
#include <stdio.h>
#include <graphics.h>
#include <games.h>
uchar in_KempcoordX, in_KempcoordY, in_KemprawX, in_KemprawY;
static void
move_cursor(unsigned char y, unsigned char x)
{
printf("\033[%u;%uH", y + 1, x + 1);
}
static uchar spr[] = { 8,8,255,127,63,31,15,7,3,1};
int
main(void)
{
void *sp = spr;
unsigned char but;
unsigned int x, y, x1, y1;
x = 0;
y = 0;
in_MouseKempInit();
in_MouseKempSetPos(x, y);
clg();
putsprite(SPR_XOR, x, y, sp);
while (1)
{
in_MouseKemp(&but, &x1, &y1);
if (x != x1 || y != y1)
{
putsprite(SPR_XOR, x, y, sp);
x = x1;
y = y1;
putsprite(SPR_XOR, x, y, sp);
move_cursor(0, 0);
printf("%d %d ", x, y);
}
}
return 0;
}
Could you show a snippet how to use Kempston Mouse in z88dk?