home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Includes_and_Autodocs_3.5 / include / graphics / gfxmacros.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-20  |  4.0 KB  |  152 lines

  1. #ifndef    GRAPHICS_GFXMACROS_H
  2. #define    GRAPHICS_GFXMACROS_H
  3. /*
  4. **    $VER: gfxmacros.h 39.3 (31.5.1993)
  5. **    Includes Release 44.1
  6. **
  7. **
  8. **
  9. **    (C) Copyright 1985-1999 Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. #ifndef  GRAPHICS_RASTPORT_H
  18. #include <graphics/rastport.h>
  19. #endif
  20.  
  21. #ifndef  GRAPHICS_GFXBASE_H
  22. #include <graphics/gfxbase.h>
  23. #endif
  24.  
  25. #ifndef  HARDWARE_CUSTOM_H
  26. #include <hardware/custom.h>
  27. #endif
  28.  
  29. #ifndef  HARDWARE_DMABITS_H
  30. #include <hardware/dmabits.h>
  31. #endif
  32.  
  33. /* NOTE: Define the following symbol in your source code
  34.  *       if you need the old style macros defined below.
  35.  *       Otherwise you will get the more robust versions
  36.  *       instead.
  37.  */
  38. #ifdef OLD_GRAPHICS_GFXMACROS_H
  39. #define ON_DISPLAY    custom.dmacon = BITSET|DMAF_RASTER;
  40. #define OFF_DISPLAY    custom.dmacon = BITCLR|DMAF_RASTER;
  41. #define ON_SPRITE    custom.dmacon = BITSET|DMAF_SPRITE;
  42. #define OFF_SPRITE    custom.dmacon = BITCLR|DMAF_SPRITE;
  43.  
  44. #define ON_VBLANK    custom.intena = BITSET|INTF_VERTB;
  45. #define OFF_VBLANK    custom.intena = BITCLR|INTF_VERTB;
  46.  
  47. #define SetDrPt(w,p)    {(w)->LinePtrn = p;(w)->Flags |= FRST_DOT;(w)->linpatcnt=15;}
  48. #define SetAfPt(w,p,n)    {(w)->AreaPtrn = p;(w)->AreaPtSz = n;}
  49.  
  50. #define SetOPen(w,c)    {(w)->AOlPen = c;(w)->Flags |= AREAOUTLINE;}
  51. #define SetWrMsk(w,m)    {(w)->Mask = m;}
  52.  
  53. /* the SafeSetxxx macros are backwards (pre V39 graphics) compatible versions */
  54. /* using these macros will make your code do the right thing under V39 AND V37 */
  55. #define SafeSetOutlinePen(w,c)      {if (GfxBase->LibNode.lib_Version<39) { (w)->AOlPen = c;(w)->Flags |= AREAOUTLINE;} else SetOutlinePen(w,c); }
  56. #define SafeSetWriteMask(w,m)    {if (GfxBase->LibNode.lib_Version<39) { (w)->Mask = (m);} else SetWriteMask(w,m); }
  57.  
  58. /* synonym for GetOPen for consistency with SetOutlinePen */
  59. #define GetOutlinePen(rp) GetOPen(rp)
  60.  
  61. #define BNDRYOFF(w)    {(w)->Flags &= ~AREAOUTLINE;}
  62.  
  63. #define CINIT(c,n)      UCopperListInit(c,n);
  64. #define CMOVE(c,a,b)    { CMove(c,&a,b);CBump(c); }
  65. #define CWAIT(c,a,b)    { CWait(c,a,b);CBump(c); }
  66. #define CEND(c)    { CWAIT(c,10000,255); }
  67.  
  68. #define DrawCircle(rp,cx,cy,r)    DrawEllipse(rp,cx,cy,r,r);
  69. #define AreaCircle(rp,cx,cy,r)    AreaEllipse(rp,cx,cy,r,r);
  70. #else /* OLD_GRAPHICS_GFXMACROS_H */
  71.  
  72.  
  73. #define ON_DISPLAY    custom.dmacon = BITSET|DMAF_RASTER
  74. #define OFF_DISPLAY    custom.dmacon = BITCLR|DMAF_RASTER
  75. #define ON_SPRITE    custom.dmacon = BITSET|DMAF_SPRITE
  76. #define OFF_SPRITE    custom.dmacon = BITCLR|DMAF_SPRITE
  77.  
  78. #define ON_VBLANK    custom.intena = BITSET|INTF_VERTB
  79. #define OFF_VBLANK    custom.intena = BITCLR|INTF_VERTB
  80.  
  81.  
  82. #define SetDrPt(w,p)    do { \
  83.                 (w)->LinePtrn = (p); \
  84.                 (w)->Flags |= FRST_DOT; \
  85.                 (w)->linpatcnt = 15; \
  86.             } while (0)
  87.  
  88. #define SetAfPt(w,p,n)    do { \
  89.                 (w)->AreaPtrn = p; \
  90.                 (w)->AreaPtSz = n; \
  91.             } while (0)
  92.  
  93. #define SetOPen(w,c)    do { \
  94.                 (w)->AOlPen = c; \
  95.                 (w)->Flags |= AREAOUTLINE; \
  96.             } while (0)
  97.  
  98. #define SetWrMsk(w,m)    do { \
  99.                 (w)->Mask = m; \
  100.             } while (0)
  101.  
  102. /* the SafeSetxxx macros are backwards (pre V39 graphics) compatible versions */
  103. /* using these macros will make your code do the right thing under V39 AND V37 */
  104.  
  105. #define SafeSetOutlinePen(w,c)    do { \
  106.                     if (GfxBase->LibNode.lib_Version < 39) \
  107.                         SetOPen(w,c); \
  108.                     else \
  109.                         SetOutlinePen(w,c); \
  110.                 } while (0)
  111.  
  112. #define SafeSetWriteMask(w,m)    do { \
  113.                     if (GfxBase->LibNode.lib_Version < 39) \
  114.                         SetWrMsk(w,m); \
  115.                     else \
  116.                         SetWriteMask(w,m); \
  117.                 } while (0)
  118.  
  119. /* synonym for GetOPen for consistency with SetOutlinePen */
  120. #define GetOutlinePen(rp) GetOPen(rp)
  121.  
  122.  
  123. #define BNDRYOFF(w)    do { \
  124.                 (w)->Flags &= ~AREAOUTLINE; \
  125.             } while (0)
  126.  
  127.  
  128. #define CINIT(c,n)    UCopperListInit(c,n)
  129.  
  130. #define CMOVE(c,a,b)    do { \
  131.                 CMove(c,&a,b); \
  132.                 CBump(c); \
  133.             } while (0)
  134.  
  135. #define CWAIT(c,a,b)    do { \
  136.                 CWait(c,a,b); \
  137.                 CBump(c); \
  138.             } while (0)
  139.  
  140. #define CEND(c)        do { \
  141.                 CWAIT(c,10000,255); \
  142.             } while (0)
  143.  
  144.  
  145. #define DrawCircle(rp,cx,cy,r)    DrawEllipse(rp,cx,cy,r,r)
  146. #define AreaCircle(rp,cx,cy,r)    AreaEllipse(rp,cx,cy,r,r)
  147.  
  148.  
  149. #endif /* OLD_GRAPHICS_GFXMACROS_H */
  150.  
  151. #endif    /* GRAPHICS_GFXMACROS_H */
  152.