home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / grafix / boards / a2410src.lha / Public / Source / mouse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-02  |  1.7 KB  |  73 lines

  1. /* 
  2.  
  3.     Busy Maustreiber for a2410 !
  4.  
  5.     name   : mouse.c
  6.     path   : daten:c_src/a2410
  7.     author : jürgen schober
  8.     date   : 18.10.1994
  9.     last changed : 19.10.1994
  10.  
  11. */
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <exec/types.h>
  16. #include <exec/memory.h>
  17. #include <intuition/intuitionbase.h>
  18.  
  19. #include <pragmas/exec_pragmas.h>
  20. #include <pragmas/graphics_pragmas.h>
  21. #include <pragmas/intuition_pragmas.h>
  22.  
  23. #include <a2410/devtiga.h>
  24. #include <a2410/typedefs.h>
  25. #include "gfx_pragmas.h"
  26. #include "graphics.h"
  27.  
  28. struct Library *GfxBase=NULL,*GraphicsBase=NULL;
  29. struct IntuitionBase *IntuitionBase=NULL;
  30.  
  31. /* own Prototypes */
  32.  
  33. void CloseTiga(void);
  34.  
  35. void main(int argc, char **argv)
  36. {
  37.     int x,y;
  38.     int i;
  39.     struct ColorMap *cm;
  40.     UWORD *colortable;
  41.  
  42.     onbreak(CloseTiga);
  43.  
  44.     if (!(GfxBase=(struct Library *)OpenLibrary("graphics.library",0))) CloseTiga();
  45.      if (!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))  CloseTiga();
  46.     if (!(GraphicsBase=(struct Library *)OpenLibrary("gfx.library",0l))) CloseTiga();
  47.  
  48.     cm = IntuitionBase->ActiveScreen->ViewPort.ColorMap;
  49.  
  50.     colortable = (UWORD *)cm->ColorTable;
  51.     for (i=0;i<cm->Count;i++)
  52.         GfxSetRGB4(NULL,i,((colortable[i] & 0x0f00)>>8),((colortable[i] & 0x00f0)>>4),(colortable[i] & 0x000f));
  53.  
  54.     GfxPointerXY(NULL,IntuitionBase->ActiveScreen->MouseX,IntuitionBase->ActiveScreen->MouseY);
  55.  
  56.     for (;;)
  57.     {
  58.         chkabort();
  59.         x=IntuitionBase->ActiveScreen->MouseX;
  60.         y=IntuitionBase->ActiveScreen->MouseY;
  61.         GfxPointerXY(NULL,x,y);
  62.     }
  63. }/*main*/
  64.  
  65. void CloseTiga(void)
  66. {
  67.     if (GfxBase)        CloseLibrary(GfxBase);
  68.     if (IntuitionBase)  CloseLibrary((struct Library*)IntuitionBase);
  69.     if (GraphicsBase)   CloseLibrary(GraphicsBase);
  70.     exit(0); 
  71. }
  72.  
  73.