'=========================================================================== ' Subject: DISPLAYS A CHAIN MAIL PATTERN Date: 10-20-97 (10:34) ' Author: William A. Deer Code: QB, QBasic, PDS ' Origin: ag312350@student.uq.edu.au Packet: EGAVGA.ABC '=========================================================================== ' ' Chain.BAS : A simple graphics program which displays a chain mail pattern ' on the screen. Doesn't do much else, but budding programmers may find some ' useful rountines inside. Written in Qbasic 1.1 , should run on any QB ver. ' ' Written by William Andrew DEER (REDBEAR) 16/3/97 ' Email ag312350@student.uq.oz.au ' ' DEF FNA (X) = (X / 360) * (22 / 7) * 2 ' Function to convert degrees(x) into rad DIM A, B, C, D AS INTEGER DIM X, Y, XGap, YGap AS SINGLE CONST XX = 600, YY = 479 CONST Thick = 3, Radius = 20 SCREEN 12 ' 640 * 480 * 16(255) PAINT (0, 0), 0 ' Paint BackGround as Col0 FOR A = 1 TO 5: PALETTE A, 0: NEXT A ' Blacken colours used in links XGap = 2.15 * Radius ' Set spaces between links YGap = 1.05 * Radius ' ' Generate and GET the two link forms ' In Screen 12 size% = 4 + INT((((2 * Radius) + 1) * (1) + 7) / 8) * 4 * ((2 * Radius) + 1) ' In Screen 13 ' Size% = 4 + INT((((2 * radius) + 1) * (8) + 7) / 8) * 1 * ((2 * radius) + 1) DIM Link1%(0 TO size% / 2) DIM Link2%(0 TO size% / 2) FOR A = 1 TO Thick B = Radius - A CIRCLE (Radius, Radius), B, A, FNA(0), FNA(75) CIRCLE (Radius, Radius), B, A, FNA(110), FNA(180) CIRCLE (Radius, Radius), B, A, FNA(200), FNA(340) NEXT A GET (0, 0)-(2 * Radius, 2 * Radius), Link1%(0) CLS FOR A = 1 TO Thick B = Radius - A CIRCLE (Radius, Radius), B, A, FNA(295), FNA(0) CIRCLE (Radius, Radius), B, A, FNA(25), FNA(155) CIRCLE (Radius, Radius), B, A, FNA(180), FNA(250) NEXT A GET (0, 0)-(2 * Radius, 2 * Radius), Link2%(0) ' ' Now onto the main loop ' FOR Y = 0 TO YY - (2 * Radius) STEP YGap ' For each horizontal line IF B = 0 THEN B = 1 ELSE B = 0 ' Flip between link types FOR X = 0 TO XX - Radius STEP XGap ' For each position on line IF B = 1 THEN C = XGap / 2 ' Offset some links PUT (X + C, Y), Link1%(0) ELSE C = 0 PUT (X, Y), Link2%(0) END IF NEXT X NEXT Y ' Now bring the display onto the screen quickly. ' Define colours : Varying intensities of white to simulate link edges z = 31: PALETTE 1, (65536 * z + 256 * z + z) z = 45: PALETTE 2, (65536 * z + 256 * z + z) z = 31: PALETTE 3, (65536 * z + 256 * z + z) z = 45: PALETTE 4, (65536 * z + 256 * z + z) WHILE INKEY$ = "" WEND