737104@sheoak.bcae.oz (David Thiele) (11/19/90)
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... Dave 737104@sheoak.bcae.oz (mail may bounce so its better to post here)
mapjilg@gdr.bath.ac.uk (J I L Gold) (11/20/90)
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 :-) #