MODULE S4Part7; FROM IO IMPORT WrStr, WrLn, RdKey, WrCard, RdLn; FROM Lib IMPORT Delay; (* Delay: let the program wait a little time *) (* de graphics library vind je onder O:/TW/Win32App/Xds/Def/Ts/Graph.def *) FROM Graph IMPORT Init, Rectangle, Circle, Disc; FROM Graph IMPORT _clrBLACK, _clrBLUE, _clrGREEN, _clrCYAN, _clrRED, _clrMAGENTA; FROM Graph IMPORT _clrBROWN, _clrWHITE, _clrGRAY, _clrLIGHTBLUE, _clrLIGHTGREEN; FROM Graph IMPORT _clrLIGHTCYAN, _clrLIGHTRED, _clrLIGHTMAGENTA, _clrLIGHTYELLOW, _clrBRIGHTWHITE; (* deze 16 kleuren zijn constantes gaande van 0 tot 15 *) CONST MAX = 49; SIZE = 8; DELAY_TIME = 0; VAR i,j,k,l, kleur:CARDINAL; blocks_x, blocks_y: ARRAY[1..MAX] OF CARDINAL; x:CHAR; BEGIN (* Initialise graphics *) IF NOT Init(1, 1 , 800, 816) THEN (* creates a drawing window of 900 by 700 *) WrStr("Sorry, graphics doesn't work");WrLn; RETURN; END; FOR l := 1 TO 3 DO FOR j := 1 TO MAX DO k := (j-1); kleur := (j MOD 15) + 1; (* Eerste stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := i * SIZE + k * SIZE; blocks_y[i] := ((MAX + 1) * SIZE) - i * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; (* Tweede stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := ((MAX - 1) * SIZE) + i * SIZE; blocks_y[i] := i * SIZE + k * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; (* Derde stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := ((2 * MAX) * SIZE) - i * SIZE - k * SIZE; blocks_y[i] := ((MAX - 1) * SIZE) + i * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; (* Vierde stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := ((MAX + 1) * SIZE) - i * SIZE; blocks_y[i] := ((2 * MAX) * SIZE) - i * SIZE - k * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; Delay(50); END; FOR j := MAX TO 1 BY (-1) DO k := (j-1); kleur := 0; (* Eerste stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := i * SIZE + k * SIZE; blocks_y[i] := ((MAX + 1) * SIZE) - i * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; (* Tweede stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := ((MAX - 1) * SIZE) + i * SIZE; blocks_y[i] := i * SIZE + k * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; (* Derde stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := ((2 * MAX) * SIZE) - i * SIZE - k * SIZE; blocks_y[i] := ((MAX - 1) * SIZE) + i * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; (* Vierde stuk tekenen *) (* Array vullen *) FOR i:= 1 TO (MAX-k) DO blocks_x[i] := ((MAX + 1) * SIZE) - i * SIZE; blocks_y[i] := ((2 * MAX) * SIZE) - i * SIZE - k * SIZE; END; (* Grafiek tekenen *) Rectangle(blocks_x[1], blocks_y[1], blocks_x[1]+SIZE, blocks_y[1]+SIZE, kleur, TRUE); FOR i:= 2 TO (MAX-k) DO Delay(DELAY_TIME); (* Rectangle(blocks_x[i-1], blocks_y[i-1], blocks_x[i-1]+SIZE, blocks_y[i-1]+SIZE, _clrBLACK, TRUE); *) Rectangle(blocks_x[i], blocks_y[i], blocks_x[i]+SIZE, blocks_y[i]+SIZE, kleur, TRUE); END; Delay(50); END; END; (* Show graphics until user presses a key *) (* WrStr("Press any key to finish the program"); x := RdKey(); WrLn; WrLn;*) END S4Part7.