home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
145.lha
/
BonsaiConstructionSet
/
trees3.h
< prev
Wrap
C/C++ Source or Header
|
1986-11-21
|
6KB
|
215 lines
/* trees3.h--definitions, etc with a little help from Lattice et al */
#include "exec/types.h"
#include "exec/nodes.h"
#include "exec/lists.h"
#include "exec/ports.h"
#include "exec/devices.h"
#include "devices/keymap.h"
#include "graphics/regions.h"
#include "graphics/copper.h"
#include "graphics/gels.h"
#include "graphics/gfxbase.h"
#include "graphics/gfx.h"
#include "graphics/sprite.h"
#include "graphics/clip.h"
#include "graphics/view.h"
#include "graphics/rastport.h"
#include "graphics/layers.h"
#include "devices/timer.h"
#include "libraries/dos.h"
#include "lattice/stdio.h"
#include "lattice/math.h"
#include "intuition/intuition.h"
#include "hardware/dmabits.h"
#include "hardware/custom.h"
#include "hardware/blit.h"
#include "graphics/text.h"
#define NL 0
long GfxBase = 0; /* Base of graphics library */
long IntuitionBase = 0; /* Base of Intuition library */
struct Window *OpenWindow();
struct DateStamp now;
long holdtime;
static struct timerequest Time_Req;
static struct MsgPort *Timer_Port = NULL, *CreatePort();
struct InputEvent *Intuition();
struct Screen *OpenScreen();
struct TextAttr TestFont = {
"topaz.font",TOPAZ_SIXTY,FS_NORMAL,FPF_ROMFONT, /* Define text font for screen */
};
USHORT class; /* Intu event class */
USHORT code; /* Intu event code */
struct Window *wd; /* Lots of pointers for lots of things */
struct RastPort *rp;
struct ViewPort *vp;
struct Screen *screen;
#define height 14
struct SpriteImage {
UWORD posctl[2];
UWORD sprdata[2][height];
UWORD reserved[2];
};
/********************Sprite-Pointer-Defines*********************/
struct SpriteImage PointImage = {
100,100,
0x0000, 0x3ffe,
0x0000, 0x3ffe,
0x0080, 0x3ffe,
0x0080, 0x1ffc,
0x0080, 0x1ffc,
0x0080, 0x0ff8,
0x0080, 0x0ff8,
0x0000, 0x07f0,
0x0080, 0x07f0,
0x0080, 0x07f0,
0x0000, 0x03e0,
0x0000, 0x03e0,
0x0000, 0x01c0,
0x0000, 0x0080,
NULL,NULL
};
struct SpriteImage TreeImage = {
100,100,
0x0000, 0x0080,
0x0000, 0x01c0,
0x0000, 0x03e0,
0x0000, 0x07f0,
0x0000, 0x0ff8,
0x0000, 0x1ffc,
0x0000, 0x3ffe,
0x0000, 0x7fff,
0x01c0, 0x01c0,
0x01c0, 0x01c0,
0x01c0, 0x01c0,
0x01c0, 0x01c0,
0x01c0, 0x01c0,
0x01c0, 0x01c0,
NULL,NULL
};
int MathBase;
int MathTransBase;
union kludge1
{
FLOAT num1;
int i1;
} k1;
union kludge2
{
FLOAT num2;
int i2;
} k2;
union kludge3
{
FLOAT num3;
int i3;
} k3;
union kludge4
{
FLOAT num4;
int i4;
} k4;
union kludge5
{
FLOAT num5;
int i5;
} k5;
union kludge6
{
FLOAT num6;
int i6;
} k6;
/************************ Screen Defines ***********************************/
struct NewScreen ns = {
0,0, /* start pos.*/
320,200,5, /* width height depth (5 bit planes) */
0,1, /* detail pen, block pen */
0, /* viewing mode (normal 320x200) */
CUSTOMSCREEN, /* screen type */
&TestFont, /* font */
NULL, /* screen title */
NULL,
NULL, /* gadget pointer */
};
/************************ Window Defines ***********************************/
struct NewWindow nw = {
0,0, /* Starting corner */
320,200, /* Width, height */
0,3, /* detail, block pens */
CLOSEWINDOW | MENUPICK
| REFRESHWINDOW | MOUSEBUTTONS | MOUSEMOVE, /* IDCMP flags */
SMART_REFRESH | ACTIVATE | BORDERLESS | WINDOWCLOSE
| REPORTMOUSE | GIMMEZEROZERO,
/* Window flags */
NULL, /* Pointer to first gadget */
NULL, /* Pointer to checkmark */
"BCS", /* title */
NULL, /* screen pointer */
NULL, /* bitmap pointer */
0,0,0,0, /* sizing limits */
CUSTOMSCREEN /* type of screen */
};
/************************ Set-Up routine ***********************************
* This function opens the Intuition and Graphics libraries, then *
* opens up our custom screen and window, defining screen colors, *
* size, etc... *
***************************************************************************/
initwind()
{
register int dd,n;
GfxBase = OpenLibrary("graphics.library",0); /* Get graphics driver */
if(GfxBase == NULL)
{
printf("Can't open graphics library...\n");
exit();
}
if((MathBase=OpenLibrary("mathffp.library",0)) < 1) {
printf("n\n*** ERROR *** Can't open mathffp.library");
exit();
}
if((MathTransBase=OpenLibrary("mathtrans.library",0)) < 1) {
printf("n\n*** ERROR *** Can't open mathtrans.library");
exit();
}
IntuitionBase = OpenLibrary("intuition.library",0); /*Get Intuition*/
if(IntuitionBase == NULL)
{
printf("Can't open intuition library...\n");
exit();
}
screen = OpenScreen(&ns); /* Open our new screen */
if(screen == NULL)
{
exit(0);
}
Timer_Port = CreatePort("Timer Port",0);
if(Timer_Port == NULL)
{
printf("Can't create timer port...\n");
exit();
}
if (OpenDevice(TIMERNAME, UNIT_VBLANK, (char *) &Time_Req,0) != NULL)
{
printf("Can't open timer device");
exit();
}
DateStamp(&now);
holdtime = now.ds_Minute + now.ds_Tick;
srand48(holdtime); /* randomize random generator */
nw.Screen = screen;
wd = OpenWindow(&nw); /* Open our new window */
rp = wd->RPort; /* Get the raster port pointer */
vp = &screen->ViewPort; /* Get the view port pointer */
SetDrMd(rp,JAM1);
for (n=0;n<=holdtime;n++)
dd=RangeRand(15);
}