#include #include #include #include #include #include #define DEPTH 4 #define PIXELS (64*64) extern void WritePixelArray(register __a0 UBYTE *start, register __a1 UBYTE *end, register __a2 struct BitMap *dest); struct screenInfo { struct TextAttr *ta; /* Custom font */ struct BitMap *bm; /* Custom bitmap */ STRPTR title; ULONG *rgb; /* Colors */ }; /* Open screen with optional properties */ struct Screen *openScreen(struct screenInfo *si) { struct Screen *s; if (s = OpenScreenTags(NULL, SA_Left, 0, SA_Top, 0, SA_Width, 320, SA_Height, 256, SA_DisplayID, LORES_KEY, SA_Quiet, TRUE, SA_Exclusive, TRUE, SA_ShowTitle, FALSE, SA_Title, si->title, SA_BackFill, LAYERS_NOBACKFILL, si->ta ? SA_Font : TAG_IGNORE, si->ta, si->bm ? SA_BitMap : TAG_IGNORE, si->bm, si->rgb ? SA_Colors32 : TAG_IGNORE, si->rgb, TAG_DONE)) { return(s); } return(NULL); } /* Example use of openScreen */ struct Screen *simpleScreen(struct screenInfo *si) { struct Screen *s; UBYTE *pixels; struct BitMap *aux; /* Alloc custom bitmap */ if (si->bm = AllocBitMap(320, 256, DEPTH, BMF_DISPLAYABLE | BMF_CLEAR, NULL)) { if (pixels = AllocMem(PIXELS, MEMF_PUBLIC)) { if (aux = AllocBitMap(64, 64, DEPTH, 0, NULL)) { /* InitRastPort(&rp); rp.BitMap = si->bm; SetAPen(&rp, 3); RectFill(&rp, 16, 16, 63, 63); */ WORD i; for (i = 0; i < (PIXELS >> 2); i++) { ((ULONG *)pixels)[i] = 0x00000000; } /* WritePixelArray(pixels, pixels + PIXELS, si->bm); */ si->title = "Magazyn"; si->rgb = NULL; /* Load from IFF CMAP */ si->ta = NULL; /* Open font */ if (s = openScreen(si)) { WORD c, k, j, l; struct ColorMap *cm = s->ViewPort.ColorMap; for (c = 0; c < 16; c++) { SetRGB4CM(cm, c, 0, 0, c); } MakeScreen(s); RethinkDisplay(); for (k = 0; k < 4; k++) { for (l = 0; l < 5; l++) { for (j = 0; j < 16; j++) { for (i = 0; i < (PIXELS >> 2); i++) { ((ULONG *)pixels)[i] = j * 0x01010101; } WaitBlit(); WritePixelArray(pixels, pixels + PIXELS, aux); WaitTOF(); BltBitMap(aux, 0, 0, si->bm, l << 6, k << 6, 64, 64, 0xc0, 0x0f, NULL); } } } FreeBitMap(aux); FreeMem(pixels, PIXELS); return(s); } FreeBitMap(aux); } FreeMem(pixels, PIXELS); } FreeBitMap(si->bm); } return(NULL); } void closeScreen(struct Screen *s, struct screenInfo *si) { CloseScreen(s); FreeBitMap(si->bm); } main() { static struct screenInfo si; struct Screen *s; if (s = simpleScreen(&si)) { Delay(300); closeScreen(s, &si); } return(0); }