home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR3 / MOUSE256.ZIP / MOUSE256.C next >
Text File  |  1993-11-21  |  5KB  |  105 lines

  1. /****************************************************************************\
  2. *                                                                            *
  3. *  MOUSE256.C                                                                *
  4. *                                                                            *
  5. *  This example program shows how to create a multi-colored mouse cursor     *
  6. *  with Fastgraph in 256-color XVGA and SVGA graphics modes.  The program    *
  7. *  calls an assembly language function SETMOUSE (in the file SETMOUSE.ASM)   *
  8. *  that stores the mouse cursor screen and cursor masks in Fastgraph's       *
  9. *  internal data area.                                                       *
  10. *                                                                            *
  11. *  The mouse_masks array is a 16x16 grid containing alternating screen and   *
  12. *  cursor mask values for each pixel in the mouse cursor.  The values are    *
  13. *  arranged as 16 rows (from top to bottom), each containing mask values for *
  14. *  16 pixels (from left to right).  Passing this array to SETMOUSE changes   *
  15. *  the mouse cursor.  Refer to Chapter 14 in the Fastgraph User's Guide for  *
  16. *  more detailed information about the mouse cursor screen and cursor masks. *
  17. *                                                                            *
  18. *  When calling SETMOUSE, the mouse cursor must be INVISIBLE.                *
  19. *                                                                            *
  20. *  Copyright (c) 1993 Ted Gruber Software.  All rights reserved.             *
  21. *                                                                            *
  22. \****************************************************************************/
  23.  
  24. #include <fastgraf.h>
  25.  
  26. unsigned char far mouse_masks[] =
  27. {
  28.    255,  0,  0,  9,  0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,
  29.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  30.  
  31.    255,  0,  0,  9,  0, 14,  0,  9,255,  0,255,  0,255,  0,255,  0,
  32.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  33.  
  34.    255,  0,  0,  9,  0, 14,  0, 14,  0,  9,255,  0,255,  0,255,  0,
  35.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  36.  
  37.    255,  0,  0,  9,  0, 14,  0, 14,  0, 14,  0,  9,255,  0,255,  0,
  38.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  39.  
  40.    255,  0,  0,  9,  0, 14,  0, 14,  0, 14,  0, 14,  0,  9,255,  0,
  41.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  42.  
  43.    255,  0,  0,  9,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,  0,  9,
  44.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  45.  
  46.    255,  0,  0,  9,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,
  47.      0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  48.  
  49.    255,  0,  0,  9,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,
  50.      0, 14,  0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  51.  
  52.    255,  0,  0,  9,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,
  53.      0, 14,  0, 14,  0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,
  54.  
  55.    255,  0,  0,  9,  0, 14,  0, 14,  0, 14,  0, 14,  0, 14,  0,  9,
  56.      0,  9,  0,  9,  0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,
  57.  
  58.    255,  0,  0,  9,  0, 14,  0, 14,  0,  9,  0, 14,  0, 14,  0,  9,
  59.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  60.  
  61.    255,  0,  0,  9,  0, 14,  0,  9,255,  0,  0,  9,  0, 14,  0, 14,
  62.      0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  63.  
  64.    255,  0,  0,  9,  0,  9,255,  0,255,  0,  0,  9,  0, 14,  0, 14,
  65.      0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  66.  
  67.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,  0,  9,  0, 14,
  68.      0, 14,  0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  69.  
  70.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,  0,  9,  0, 14,
  71.      0, 14,  0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,
  72.  
  73.    255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0,  0,  9,
  74.      0,  9,  0,  9,255,  0,255,  0,255,  0,255,  0,255,  0,255,  0
  75. };
  76.  
  77. main()
  78. {
  79.    /* initialize Fastgraph for mode 20 */
  80.  
  81.    fg_setmode(20);
  82.  
  83.    /* show the default mouse cursor against a white background */
  84.  
  85.    fg_mouseini();
  86.    fg_setcolor(15);
  87.    fg_fillpage();
  88.    fg_mousevis(1);
  89.    fg_waitkey();
  90.  
  91.    /* change the cursor outline to light blue (color 9), */
  92.    /* and pixels inside the cursor to yellow (color 14)  */
  93.  
  94.    fg_mousevis(0);
  95.    setmouse(mouse_masks);
  96.    fg_mousevis(1);
  97.    fg_waitkey();
  98.  
  99.    /* restore 80x25 text mode */
  100.  
  101.    fg_mousefin();
  102.    fg_setmode(3);
  103.    fg_reset();
  104. }
  105.