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 >
Wrap
Text File
|
1990-11-10
|
4KB
|
109 lines
MACROS this file describes several macros that have been defined
in ezlib.h
The file ezlib.h contains a few macros to 1) in general make life a
little easier, and 2) to facilitate working with ez.lib.
As mentioned in openlibs.doc, there are several numbers defined to
specify which libraries to open in a call to openlibs(). They are:
#define GFX 0x001
#define INTUI 0x002
#define INTUITION 0x002
#define ARP 0x004
#define DFONT 0x008
#define DISKFONT 0x008
#define TRANSLATOR 0x010
#define REXX 0x100
As you can see, they are readily or'ed together to open several
libraries at once. Not much else to say here.
----------------------------------------------------------------------
Next there is the MSG() macro taken from an old Transactor. This is a
simple macro to put out a string onto whatever output stream may be
attatched to your program (i.e. whether from WorkBench or the CLI). It is
defined as follows :
#define MSG(a) (Write(Output(), a, strlen(a)))
Again, it will simply dump out a string onto your output stream. Note
that it is NOT the same as a printf() call and does NOT take formatting
arguments as does printf().
----------------------------------------------------------------------
Following are macros to set the colors on a custom screen. Several
"colors" have also been defined. The macro is setcolor() and is called
like this :
setcolor(screen, num, color)
Screen is the pointer to your custom screen which you opened earlier with
makescreen() or similar.
Num is the number of the color register you wish to set. The highest color
register which you can set is dependent on the depth of the depth (in
bitplanes) of your screen. In any case, it will never be more than 32.
Color is the actual color you wish to set. It is a number between 0 and
4,095. Essentially, only the first twelve (12) bits matter. The color
defined by your number is as follows: The first 4 bits (0-3) are BLUE.
The next 4 bits (4-7) are GREEN, and the next 4 bits (8-11) are RED. To
define a pure blue color, you would specify (in hex) 0x00f. A nice purple
would be (again in hex) 0xf0f. To save you the hassle of figuring out what
color is what, I have defined the following colors in ezlib.h :
BLACK WHITE RED GREEN BLUE YELLOW
PINK PURPLE GREY0 GREY1 GREY2 GREY3
ORANGE INDIGO CYAN GOLD
For example to set the background color of your screen to GREEN, all
you need do (after having opened a screen) is the following:
setcolor(screen, 0, GREEN);
For the curious, setcolor() calls SetRGB4().
----------------------------------------------------------------------
The are 5 more #defines. They are :
initgfx() - simply a call to openlibs(GFX)
closegfx() - simply a call to closelibs (be careful as
this will also close everything else)
Print(rp, string) - Call this with a RastPort pointer and a
a string. That string will be printed
starting at the current pen location in
that RastPort.
Circle(rp, x, y, rad) - Draw a circle at x,y with radius rad in the
rastport pointed to by rp.
Line(rp, x1, y1, x2, y2) - Draw a line from x1,y1 to x2,y2. Believe it or
not, there is no function like this in Gfxlib.
You are supposed to Move() then Draw(). This
macro takes care of that for you.
Remember, the last 3 "functions" are really just #defines, so there is
no overhead in calling them.
----------------------------------------------------------------------
That about covers the ezlib.h file. I have also defined some
functions and their return values, but not having an ANSI compiler I
haven't prototyped them. This would be a *very* good idea to do (so would
getting an ANSI compiler ;-).
TODO - can't think of anything
BUGS - in a #define ? ;-)