/* hypocycloid.h--definitions, etc with a little help from Lattice et al */ #include #include #include #include #include #include #include #include #include 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 *w; /* Lots of pointers for lots of things */ struct RastPort *rp; struct ViewPort *vp; struct Screen *screen; 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; /************************ Screen Defines ***********************************/ struct NewScreen ns = { 0,0, /* start pos.*/ 320,200,5, /* width height depth (5 bit planes) */ 0,2, /* 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, /* IDCMP flags */ SMART_REFRESH + ACTIVATE + WINDOWDEPTH + BORDERLESS + WINDOWCLOSE, /* Window flags */ NULL, /* Pointer to first gadget */ NULL, /* Pointer to checkmark */ " Hypocycloid", /* 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() { long l; int dd; double d; 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; for (l=0;l<=holdtime;l+=4){ /* randomize random generators */ dd=RangeRand(15); d=drand48(); } nw.Screen = screen; w = OpenWindow(&nw); /* Open our new window */ rp = w->RPort; /* Get the raster port pointer */ vp = &screen->ViewPort; /* Get the view port pointer */ SetRGB4(vp,0,0,0,15); /* Color 0 is blue */ SetRGB4(vp,1,15,0,0); SetRGB4(vp,2,0,15,0); SetRGB4(vp,3,15,15,15); SetDrMd(rp,JAM1); }