home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* EXGRDEMO.PAS *)
- (* Demonstriert den Einsatz der Unit EXGRAPH.TPU *)
- (* (c) 1989 Markus Kucborski & TOOLBOX *)
- (* ------------------------------------------------------ *)
- PROGRAM ExGraphDemo;
-
- USES Graph, ExGraph, Crt;
-
- CONST
- MaxSlices = 12; (* variable Werte möglich *)
- LoadImages = FALSE; (* lädt von Disk Maxslices-Images *)
- SaveImages = FALSE; (* speichert am Ende die Images ab *)
- Headline = 'Dies ist eine Demo fuer die Unit EXGRAPH.';
- NoMsg = '';
-
- VAR
- Image : ARRAY[1..MaxSlices] OF ImageRec;
- Radius, x, y, Degree, i : INTEGER;
-
-
- PROCEDURE Init(VAR x, y, Radius, Degree : INTEGER);
- VAR Graphmode, Graphdriver : INTEGER;
- BEGIN
- GraphDriver := Detect;
- InitGraph(Graphdriver, GraphMode, '');
- Radius := GetMaxY DIV 15;
- x := GetMaxX DIV 2;
- y := GetMaxY DIV 2;
- Degree := 60 DIV MaxSlices;
- Rectangle(0, 0, GetMaxX, Textheight('H') + 4);
- OutTextXY((GetMaxX - 1 -
- Textwidth(Headline)) DIV 2, 2, Headline);
- END;
-
-
- PROCEDURE ShowMsg(msg : STRING);
- BEGIN
- Bar(0, Radius-2, GetMaxX, Radius + TextHeight('H')+2);
- OutTextXY((GetMaxX - TextWidth(Msg)) DIV 2, Radius,Msg);
- END;
-
-
- PROCEDURE MovePac;
- CONST up : BOOLEAN = TRUE;
- i : INTEGER = MaxSlices;
- BEGIN
- ShowMsg('Ende der Animation durch irgendeine Taste');
- REPEAT
- IF (i = MaxSlices) OR (i = 1) THEN up := NOT up;
- IF up THEN Inc(i) ELSE Dec(i);
- PutImage(GetMaxY - 2*Radius, GetMaxY - 2*Radius,
- Image[i].Img^, XorPut);
- PutImage(GetMaxY - 2*Radius, GetMaxY - 2*Radius,
- Image[i].Img^, XorPut);
- UNTIL KeyPressed;
- ShowMsg(NoMsg)
- END;
-
-
- PROCEDURE DisplayAllImages;
- VAR x, y : INTEGER;
- BEGIN
- y := 3*Radius;
- x := -2*Radius;
- FOR i := 1 TO Maxslices DO BEGIN
- IF (x + 2*Radius + 5) < GetMaxX THEN
- Inc(x, 2*Radius + 5)
- ELSE BEGIN
- Inc(y, 2*Radius + 2);
- x := 1;
- END;
- PutImage(x, y, Image[i].Img^, XorPut)
- END;
- END;
-
-
- BEGIN
- Init(x, y, Radius, Degree);
- SetFillStyle(WideDotFill, Black);
- ShowMsg('Initialisiere BildSequenz ');
- FOR i := 1 TO MaxSlices DO
- IF LoadImages THEN BEGIN
- ShowMsg(' Lade BildSequenz ');
- LoadImg('Pac' + Chr(64+i) + '.img', Image[i]);
- END ELSE BEGIN
- PieSlice(x, y, i*Degree, 360 - Degree*i, Radius);
- PieSlice(x, y - Radius DIV 3, 0, 360, Radius DIV 5);
- CatchImg(x-Radius, y-Radius, x+Radius, y+Radius,
- Image[i]);
- PutImage(x-Radius, y-Radius, Image[i].Img^, XorPut);
- END;
- DisplayAllImages;
- MovePac;
- FOR i := 1 TO MaxSlices DO BEGIN
- IF SaveImages THEN BEGIN
- ShowMsg('Speichere Bildsequenz');
- SaveImg('pac' + Chr(64+i) + '.img', Image[i]);
- END;
- FreeImg(Image[i]);
- END;
- CloseGraph;
- END.
-
- (* ------------------------------------------------------ *)
- (* Ende von EXGRDEMO.PAS *)