From: cuz Date: Thu, 13 Sep 2001 15:58:59 +0000 (+0000) Subject: Removed mousetest.c, it's now a sample program X-Git-Tag: V2.12.0~2676 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=40aa38a6fdb13f90950718c5f20927588eecadab;p=cc65 Removed mousetest.c, it's now a sample program git-svn-id: svn://svn.cc65.org/cc65/trunk@905 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/testcode/lib/mousetest.c b/testcode/lib/mousetest.c deleted file mode 100644 index 7b031f0ac..000000000 --- a/testcode/lib/mousetest.c +++ /dev/null @@ -1,123 +0,0 @@ -#include -#include -#include -#include - - - -#if defined(__C64__) || defined(__C128__) - -/* Address of data for sprite 1 */ -#define SPRITE1_DATA 0x340 - -/* The mouse sprite (an arrow) */ -static const unsigned char MouseSprite[64] = { - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x0F, 0xE0, 0x00, - 0x0F, 0xC0, 0x00, - 0x0F, 0x80, 0x00, - 0x0F, 0xC0, 0x00, - 0x0D, 0xE0, 0x00, - 0x08, 0xF0, 0x00, - 0x00, 120, 0x00, - 0x00, 60, 0x00, - 0x00, 30, 0x00, - 0x00, 0x0F, 0x00, - 0x00, 0x07, 0x80, - 0x00, 0x03, 0x80, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00 -}; - -#endif - - -static void ShowState (unsigned char Invisible) -/* Display cursor visibility */ -{ - gotoxy (0, 6); - cclear (40); - gotoxy (0, 6); - cprintf ("Mouse cursor %svisible", Invisible? "in" : ""); -} - - - -int main (void) -{ - struct mouse_info info; - unsigned char Invisible; - - /* Clear the screen, set white on black */ - bordercolor (COLOR_BLACK); - bgcolor (COLOR_BLACK); - textcolor (COLOR_GRAY3); - cursor (0); - clrscr (); - - /* Print a help line */ - cputsxy (0, 0, "s = show h = hide q = quit"); - -#if defined(__C64__) || defined(__C128__) - /* Copy the sprite data */ - memcpy ((void*) SPRITE1_DATA, MouseSprite, sizeof (MouseSprite)); - - /* Set the VIC sprite pointer */ - *(unsigned char*)0x7F8 = SPRITE1_DATA / 64; - - /* Set the color of sprite 0 */ - VIC.spr0_color = COLOR_WHITE; - - /* Initialize the mouse */ - mouse_init (0, 1, MOUSE_C64); -#endif - - /* Move the mouse to the center of the screen */ - mouse_move (160, 100); - - /* Test loop */ - ShowState (Invisible = 1); - while (1) { - if (kbhit()) { - switch (cgetc()) { - case 's': - if (Invisible) { - ShowState (--Invisible); - mouse_show (); - } - break; - case 'h': - ShowState (++Invisible); - mouse_hide (); - break; - case 'q': - mouse_done (); - exit (0); - } - } - - /* Get the current mouse coordinates and button states and print them */ - mouse_info (&info); - gotoxy (0, 2); - cprintf ("X = %3d", info.pos.x); - gotoxy (0, 3); - cprintf ("Y = %3d", info.pos.y); - gotoxy (0, 4); - cprintf ("LB = %c", (info.buttons & MOUSE_BTN_LEFT)? '1' : '0'); - gotoxy (0, 5); - cprintf ("RB = %c", (info.buttons & MOUSE_BTN_RIGHT)? '1' : '0'); - - } - return 0; -} - - - -