home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 432b.lha / EzLib / doc / defines.doc < prev    next >
Text File  |  1990-11-10  |  4KB  |  109 lines

  1. MACROS         this file describes several macros that have been defined
  2.          in ezlib.h
  3.  
  4.     The file ezlib.h contains a few macros to 1) in general make life a
  5. little easier, and 2) to facilitate working with ez.lib.
  6.  
  7.     As mentioned in openlibs.doc, there are several numbers defined to
  8. specify which libraries to open in a call to openlibs().  They are:
  9.  
  10.             #define GFX     0x001
  11.             #define INTUI    0x002
  12.             #define INTUITION    0x002
  13.             #define ARP     0x004
  14.             #define DFONT    0x008
  15.             #define DISKFONT    0x008
  16.             #define TRANSLATOR    0x010
  17.             #define REXX    0x100
  18.  
  19.     As you can see, they are readily or'ed together to open several
  20.     libraries at once.     Not much else to say here.
  21.  
  22. ----------------------------------------------------------------------
  23.  
  24.     Next there is the MSG() macro taken from an old Transactor.  This is a
  25. simple macro to put out a string onto whatever output stream may be
  26. attatched to your program (i.e. whether from WorkBench or the CLI).  It is
  27. defined as follows :
  28.  
  29.        #define MSG(a) (Write(Output(), a, strlen(a)))
  30.  
  31.     Again, it will simply dump out a string onto your output stream.  Note
  32. that it is NOT the same as a printf() call and does NOT take formatting
  33. arguments as does printf().
  34.  
  35. ----------------------------------------------------------------------
  36.  
  37.  
  38.     Following are macros to set the colors on a custom screen.    Several
  39. "colors" have also been defined.  The macro is setcolor() and is called
  40. like this :
  41.  
  42.       setcolor(screen, num, color)
  43.  
  44. Screen is the pointer to your custom screen which you opened earlier with
  45. makescreen() or similar.
  46.  
  47. Num is the number of the color register you wish to set.  The highest color
  48. register which you can set is dependent on the depth of the depth (in
  49. bitplanes) of your screen.  In any case, it will never be more than 32.
  50.  
  51. Color is the actual color you wish to set.  It is a number between 0 and
  52. 4,095.    Essentially, only the first twelve (12) bits matter.  The color
  53. defined by your number is as follows:  The first 4 bits (0-3) are BLUE.
  54. The next 4 bits (4-7) are GREEN, and the next 4 bits (8-11) are RED.  To
  55. define a pure blue color, you would specify (in hex) 0x00f.  A nice purple
  56. would be (again in hex) 0xf0f.  To save you the hassle of figuring out what
  57. color is what, I have defined the following colors in ezlib.h :
  58.  
  59.     BLACK    WHITE    RED    GREEN    BLUE    YELLOW
  60.     PINK     PURPLE   GREY0  GREY1    GREY2   GREY3
  61.     ORANGE   INDIGO   CYAN   GOLD
  62.  
  63.     For example to set the background color of your screen to GREEN, all
  64. you need do (after having opened a screen) is the following:
  65.  
  66.             setcolor(screen, 0, GREEN);
  67.  
  68.  For the curious, setcolor() calls SetRGB4().
  69.  
  70. ----------------------------------------------------------------------
  71.  
  72.  
  73.     The are 5 more #defines.  They are :
  74.  
  75.           initgfx()    -  simply a call to openlibs(GFX)
  76.          closegfx()    -  simply a call to closelibs (be careful as
  77.                   this will also close everything else)
  78.  
  79.     Print(rp, string)  -  Call this with a RastPort pointer and a
  80.                   a string.  That string will be printed
  81.                   starting at the current pen location in
  82.                   that RastPort.
  83.  
  84.      Circle(rp, x, y, rad) -  Draw a circle at x,y with radius rad in the
  85.                   rastport pointed to by rp.
  86.  
  87.   Line(rp, x1, y1, x2, y2) -  Draw a line from x1,y1 to x2,y2.  Believe it or
  88.                   not, there is no function like this in Gfxlib.
  89.                   You are supposed to Move() then Draw().  This
  90.                   macro takes care of that for you.
  91.  
  92.     Remember, the last 3 "functions" are really just #defines, so there is
  93. no overhead in calling them.
  94.  
  95. ----------------------------------------------------------------------
  96.  
  97.  
  98.     That about covers the ezlib.h file.  I have also defined some
  99. functions and their return values, but not having an ANSI compiler I
  100. haven't prototyped them.  This would be a *very* good idea to do (so would
  101. getting an ANSI compiler ;-).
  102.  
  103.  
  104. TODO - can't think of anything
  105.  
  106. BUGS - in a #define ?  ;-)
  107.  
  108.  
  109.