🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #6861

Re: 3 bitmaps

#6861
From: J I L Gold
Date: Tue, 20 Nov 1990 13:38
57 lines
2412 bytes
In article <655@sheoak.bcae.oz> 737104@sheoak.UUCP (David Thiele) writes:
>Is it possible to have more than 2 bitmaps (DUALPF + PFTA?) associated
>with a single viewport??
>Or is there an easy way to have more than 2 bitmaps displayed at once??
>Im trying to write a multi-layer scrolling starfield in lattice C. Ive
>got 2 bitplanes working smoothly but cant squeeze out a third...
>

The scrolling starfield is best written in 68000 for speed, but you can
have the illusion of as many "planes" of stars as you like with only
one bitplane! In C, you could write

#define	NUMSTARS	32

struct Star {
	USHORT x,y;	/* Position */
	USHORT v;	/* Velocity */
} Stars[NUMSTARS] = { /* Set up initial positions here */;
		      /* The higher the v field is the */
		      /* faster a star moves, and so   */
		      /* with values from 1 to 3 gives */
		      /* the illusion of 3 planes.     */
}

and the star motion code would look like this:

void DoStars() {
	USHORT i;
	struct Star *Star;

	for(i=0;i<NUMSTARS;i++) {
		Star = &Stars[i];
		/* First erase the star */
		SetAPen(rastport,0); /* Colour 0 = black */
		WritePixel(rastport,Star->x,Star->y);
		/* Update position */
		if ((Star->x += Star->v) > 320) Star->x = 0;
		/* Now re-plot the star */
		SetAPen(rastport,1); /* Colour 1 = white */
		WritePixel(rastport,Star->x,Star->y);
	}
}

No need for dual playfields (or triple playfields!). This code will
be quite slow, because WritePixel() is filtered through the various
clipping routines. You should really poke the appopriate bit in the 
bitplane, and if you're doing that, you might as well write a 68000
module for it. 

>Dave



-- 
#  J.Gold                            |    mapjilg@uk.ac.bath.gdr               #
#  University of Bath , UK           |    jilg@uk.ac.bath.maths                #
#  The more improbable an event is, the more likely it is to happen :-)        #
Technical Details
Message-ID: <1990Nov20.133818.29024@gdr.bath.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!dcl-cs!gdt!mapjilg
References: <655@sheoak.bcae.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!dcl-cs!gdt!mapjilg
From: mapjilg@gdr.bath.ac.uk (J I L Gold)
Newsgroups: comp.sys.amiga.tech
Subject: Re: 3 bitmaps
Message-ID: <1990Nov20.133818.29024@gdr.bath.ac.uk>
Date: 20 Nov 90 13:38:18 GMT
References: <655@sheoak.bcae.oz>
Organization: Bath University Computing Services, Bath, England
Lines: 57