#ifdef LATER #define DEBUG #endif LATER #define PARANOID #include #include #include #include #include #include #include #include #include #include "jiff.h" /*This should be in exec/libraries.h */ extern struct Library *OpenLibrary(); /*This should be in intuition/intuition.h */ extern struct Screen *OpenScreen(); /* These are the bases for the libraries you need to do any graphics much at all and still multi-task */ struct Library *GfxBase = NULL; struct Library *LayersBase = NULL; struct Library *IntuitionBase = NULL; /* Well the workbench Screen isn't 320x200x5 so...*/ struct Screen *PlopScreen = NULL; /* Just one font for me... not static cause you might want it in your menu modules. */ struct TextAttr PlopFont = { "topaz.font", /* I think this is the ROM font */ 8, 0, 0, }; /* a NewScreen - I don't know what half of this means either */ static struct NewScreen PlopNewScreen = { 0, 0, XMAX, YMAX, PLANES, 0, 1, 0, CUSTOMSCREEN, &PlopFont, "Plop on Top", NULL, NULL, }; struct RastPort PlopRastPort; /*put_ea_cmap given an ea-type color map: an array of unsigned chars of form ea_cmap[] = {r, g, b, r, g, b...} turn it into an amiga-type color map: an array of unsigned short of form amiga_cmap = {0xrgb, 0xrgb, ...} and then tell Dale this is the colors we want for our viewport */ void put_ea_cmap(cmap, colors) unsigned char *cmap; int colors; { unsigned short amy_cmap[MAXCOL]; int i; unsigned char r, g, b; if (colors > MAXCOL) /*color clipping*/ colors = MAXCOL; for (i=0; i> 4); } LoadRGB4( &PlopScreen->ViewPort, amy_cmap, (long)colors); } /* back out backwards */ void plop_cleanup() { if (PlopScreen != NULL) CloseScreen(PlopScreen); if (IntuitionBase != NULL) CloseLibrary(IntuitionBase); if (LayersBase != NULL) CloseLibrary(LayersBase); if (GfxBase != NULL) CloseLibrary(GfxBase); } main(argc, argv) int argc; char *argv[]; { int i; struct ILBM_info *info; /*Before we can do ANYTHING have to get our libraries... */ if ((GfxBase = OpenLibrary("graphics.library", (long)0)) == NULL) { #ifdef PARANOID printf("Can't open Graphics Library\n"); #endif PARANOID return(-1); } if ((LayersBase = OpenLibrary("layers.library", (long)0)) == NULL) { #ifdef PARANOID printf("Can't open Layers Library\n"); #endif PARANOID plop_cleanup(); return(-2); } /* Two for Dale and one for RJ */ if ((IntuitionBase = OpenLibrary("intuition.library",(long) 0)) == NULL) { #ifdef PARANOID printf("Can't open Intuition Library\n"); #endif PARANOID plop_cleanup(); return(-3); } for (i=1; iheader.x; PlopNewScreen.TopEdge = info->header.y; PlopNewScreen.Width = info->header.w; PlopNewScreen.Height = info->header.h; PlopNewScreen.Depth = info->header.nPlanes; PlopNewScreen.ViewModes = 0; /*start at default */ if (PlopNewScreen.Depth == 6) PlopNewScreen.ViewModes |= HAM; if (PlopNewScreen.Width > 320) PlopNewScreen.ViewModes |= HIRES; if (PlopNewScreen.Height > 200) PlopNewScreen.ViewModes |= LACE; if ( (PlopScreen = OpenScreen(&PlopNewScreen) ) == NULL) { #ifdef PARANOID printf("OpenScreen failed\n"); #endif PARANOID plop_cleanup(); return(-4); } InitRastPort(&PlopRastPort); PlopRastPort.Mask = (1<cmap, (1 << info->bitmap.Depth)); PlopRastPort.BitMap = &info->bitmap; ClipBlit( &PlopRastPort, (long)0, (long)0, &PlopScreen->RastPort, (long)info->header.x, (long)info->header.y, (long)info->header.w, (long)info->header.h, (long)COPY_MINTERM); Delay( (long)250); /*pause for a couple seconds */ free_planes(&info->bitmap); } #ifdef PARANOID else printf("couldn't load %s as an IFF file\n"); #endif PARANOID } plop_cleanup(); }