/* * Initialization module of the blitlab program. */ #include "structures.h" /* * These are the externals we reference. */ extern struct Window *mywindow ; extern struct GfxBase *GfxBase ; extern struct IntuitionBase *IntuitionBase ; extern struct RastPort *myrp ; extern int custscreen ; /* * We use this memory allocator. */ extern short *allocmem() ; /* * This is the screen we use, if we use a screen. :-) */ static char defaulttitle[] = "<< Radical Eye Software . . . or I won't get dressed >>" ; static struct Screen *myscreen ; static struct TextFont *font ; static struct TextAttr myfont = { (STRPTR) "topaz.font", TOPAZ_EIGHTY, 0, 0 }; static struct NewScreen mynewscreen = { 0, /* left edge */ 0, /* top edge */ 640, /* width */ 200, /* height */ 2, /* depth (change for color?)*/ 1, /* detail pen */ 2, /* block pen */ HIRES, /* screen mode */ CUSTOMSCREEN, /* type */ &myfont, /* use default font */ (UBYTE *)defaulttitle, /* title */ NULL, /* initialize this gadget field */ NULL } ; /* no bitmap supplied */ static short colorTable[] = { 0x058f, 0x0fff, 0x0000, 0x0555 } ; static short pointerTable[] = { 0x0000, 0x0000, 0x0100, 0x0000, 0x0100, 0x0000, 0x0100, 0x0000, 0x0100, 0x0000, 0x0100, 0x0000, 0x0380, 0x0280, 0x0440, 0x0440, 0xFC7E, 0x0000, 0x0440, 0x0440, 0x0380, 0x0280, 0x0100, 0x0000, 0x0100, 0x0000, 0x0100, 0x0000, 0x0100, 0x0000, 0x0100, 0x0000, 0x0000, 0x0000 } ; /* * This is the humongous window we open on the standard * workbench screen. */ static struct NewWindow mynewwindow = { HWINSTART, VWINSTART, HWINSIZE, VWINSIZE, -1, -1, MOUSEBUTTONS | MOUSEMOVE | GADGETDOWN | GADGETUP | CLOSEWINDOW | VANILLAKEY, WINDOWDEPTH | WINDOWCLOSE | WINDOWDRAG | SMART_REFRESH | REPORTMOUSE | ACTIVATE | RMBTRAP, NULL, NULL, (UBYTE *)BANNER, NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN } ; /* * This is the main initialize routine, which gets everything started * up. */ initialize() { int i, j ; /* * First, we try and open libraries and windows. */ if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary( "intuition.library",0L))==NULL || (GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0L)) ==NULL) error("! Couldn't open libraries") ; if (custscreen) { mynewscreen.Width = GfxBase->NormalDisplayColumns ; mynewscreen.Height = GfxBase->NormalDisplayRows ; if ((myscreen=OpenScreen(&mynewscreen))==NULL) error("! Couldn't open screen") ; LoadRGB4(&(myscreen->ViewPort), colorTable, 4L) ; mynewwindow.Screen = myscreen ; mynewwindow.Type = CUSTOMSCREEN ; } if ((mywindow=OpenWindow(&mynewwindow))==NULL) error("! Couldn't open window") ; makepointer() ; myrp = mywindow -> RPort ; if (! custscreen) { font = OpenFont(&myfont) ; if (font != NULL) SetFont(myrp, font) ; } allocbitmem() ; buildgadgets() ; drawlabels() ; parseall() ; /* * Here we draw the bits array, hopefully for easy reference. */ color(BLACK) ; fbox(HBITSTART, VBITSTART, HBITSIZE, VBITSIZE) ; color(WHITE) ; box(HBITSTART, VBITSTART, HBITSIZE, VBITSIZE) ; color(ORANGE) ; for (i=1; i<24; i++) box(HBITSTART + i * 24 - 2, VBITSTART, 2, VBITSIZE) ; for (i=HBITSTART+4; i