★ CODING ★ LISTINGS ★ FANDANGO (COMPUTING WITH THE AMSTRAD) ★ |
Fandango (Computing with the Amstrad) | Coding Listings |
WHILE were waiting for you to respond in your thousands to this new feature, we've let the Features Editor loose on his Amstrad and he's come up with some pleasing graphics demonstrations -actually that's all he's capable of. In the first, each screen display lasts for 30 seconds, but you can interrupt this at any time by pressing the spacebar and starting again. You can vary the length of this display by changing the variable xx in line 10 which corresponds to the number of seconds. If you want to see a more colourful but chunky pattern, replace the MODE 1 in line 10 with MODE 0, and alter the 3 in line 50 to 15, or 12 if you don't like the flashing colours. His final offering is a routine to provide either filled or outlined circles. The actual circle routine is based on one of Bresenham's algorithms (his line was used in Roland's PCW graphics article in May), and is contained in three subroutines that you can easily incorporate into your own programs. Lines 40 and 50 make up the first subroutine and calculate the points on the circle's circumference. Lines 60 and 70 are the other two and create either a filled or an outlined circle dependent on your input. You must pass five parameters (xx,yy,r,c,a) to the subroutines and these dictate in sequence the x,y coordinates, radius, colour and type of circle. Included in the 10 lines are four separate demonstrations - two of them in line 10. In the first, the x,y coordinates and type of circle remain the same while the radius and ink numbers decrease. In the second all the parameters are generated by random numbers. The third and fourth are little surprises to show you just what you can achieve with a little imagination and planning. All the circle parameters are read in from data contained in lines 80 - 100. Now see what you can do!
CWTA
|