home *** CD-ROM | disk | FTP | other *** search
- {* Effect.PAS *}
- {* Copyright (c) Genus Microprogramming, Inc. 1988-89 All Rights Reserved. *}
-
- {****************************************************************************
-
- This program demonstrates the usage of an effect. It is an example
- Pascal routine for the PCX Effects Toolkit.
-
- To Compile: Turbo Pascal 4.x/5.x turbo fxtest
- (press "Alt-R" to run)
- or tpc fxtest
-
- Borland Turbo Pascal 4.0/5.0 Programmer: Chris Howard 5/07/89
-
- *****************************************************************************}
-
- Program fxTest;
-
- {$M 16384,0,65535}
-
- { Include the PCX Toolkit Unit, and the PCX Effects Unit }
- uses pcx_tp,fx_tp,crt;
-
- { Globals }
- const
- pcxtype : integer = pcxVGA_11;
- pcximage = 'fxTest.PCX';
-
- bufmax = 20000;
-
- var
-
- vi : array[1..2] of PCXVINFO;
- header : PCXHEADER;
-
- vfree,vreq : longint;
- vptr : longint;
-
- width,depth : integer;
- wx2,wy2 : integer;
-
- retcode : integer;
- key : char;
-
- buffer : array[1..bufmax] of byte;
-
- {**********}
-
- begin
-
- { Display program header }
- writeln;
- writeln('╒══════════════════════════════════════════════════════════════════════════╕');
- writeln('│ fxTest: Example Effect Pascal Program PCX Effects 1.0x │');
- writeln('│ Copyright (c) Genus Microprogramming, Inc. 1988-89 All Rights Reserved. │');
- writeln('╘══════════════════════════════════════════════════════════════════════════╛');
- writeln;
-
- { Get a key, to begin }
- writeln('Press a key to run . . .');
- key := ReadKey;
-
- { Allocate a larter toolkit buffer, to speed up file and display speeds }
- retcode := pcxSetBuffer(@buffer,bufmax);
-
- { Check if we have expanded memory, and display }
- if (pcxEMInstalled = pcxSUCCESS) then begin
- vfree := pcxVirtualFree(pcxEMM);
- writeln('Free EMM: ',vfree);
- end; {of if}
-
- { Display the amount of conventional free memory }
- vfree := pcxVirtualFree(pcxCMM);
- writeln('Free CMM: ',vfree);
-
- { Look at the current hardware, to find a B/W mode }
- retcode := pcxVideoInfo(@vi);
-
- case vi[1].adapter of
- viCGA: pcxtype := pcxCGA_6;
- viEGA: begin
- if (vi[1].display = viMDAdisp) then
- pcxtype := pcxEGA_F
- else
- pcxtype := pcxEGA_10;
- end;
- viVGA: pcxtype := pcxVGA_11;
- viHGC: pcxtype := pcxHERC;
- else pcxtype := -1;
- end; {of case}
-
- { If we found a mode, continue }
- if (pcxtype <> -1) then begin
-
- { Set the display type }
- retcode := pcxSetDisplay(pcxtype);
-
- { Load the image }
- retcode := fxFileImage(pcxCMM,@vptr,pcximage);
- if (retcode = fxSUCCESS) then begin
-
- { Change to graphics mode }
- retcode := pcxSetMode(pcxGRAPHICS);
-
- { Calibrate the delay timer, and play a looping song }
- retcode := fxCalibrateDelay;
- retcode := fxPlayLoop(25);
- retcode := fxPlay('T120 MB O3 L32 C D E F G A B A G F E D ');
-
- { Select our effect }
- retcode := fxSetEffect(fxRANDOM);
- retcode := fxSetGrain(8);
-
- { and do it }
- retcode := fxVirtualEffect(vptr,0,0,fxNONE);
-
- { Kill any remaining background music }
- retcode := fxPlayKill;
-
- { Wait for a key }
- key := ReadKey;
-
- { Get back to text mode }
- retcode := pcxSetMode(pcxTEXT);
-
- { Were we successful? }
- if (retcode <> fxSUCCESS) then
- writeln('pcxVirtualEffect Error: ',retcode);
-
- { Destroy the image }
- retcode := fxFreeImage(vptr);
-
- end
- else begin
- { Could not load image }
- writeln('Could not load image: ',retcode);
- end;
-
- end
- else begin
- { We could not find a good mode }
- writeln('Could not find a good mode type . . .');
- end; {of else}
-
- end. { end of main }
-
-