home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c011 / 4.ddi / EXAMPLES / PAS / FXTEST.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1989-06-01  |  4.0 KB  |  147 lines

  1. {* Effect.PAS                                                               *}
  2. {* Copyright (c) Genus Microprogramming, Inc. 1988-89  All Rights Reserved. *}
  3.  
  4. {****************************************************************************
  5.  
  6.   This program demonstrates the usage of an effect. It is an example
  7.   Pascal routine for the PCX Effects Toolkit.
  8.  
  9.   To Compile: Turbo Pascal 4.x/5.x   turbo fxtest
  10.                                      (press "Alt-R" to run)
  11.                                 or   tpc   fxtest
  12.  
  13.   Borland Turbo Pascal 4.0/5.0            Programmer: Chris Howard  5/07/89
  14.  
  15. *****************************************************************************}
  16.  
  17. Program fxTest;
  18.  
  19. {$M 16384,0,65535}
  20.  
  21. { Include the PCX Toolkit Unit, and the PCX Effects Unit }
  22. uses pcx_tp,fx_tp,crt;
  23.  
  24. { Globals }
  25. const
  26.   pcxtype        : integer = pcxVGA_11;
  27.   pcximage       = 'fxTest.PCX';
  28.  
  29.   bufmax         = 20000;
  30.  
  31. var
  32.  
  33.   vi             : array[1..2] of PCXVINFO;
  34.   header         : PCXHEADER;
  35.  
  36.   vfree,vreq     : longint;
  37.   vptr           : longint;
  38.  
  39.   width,depth    : integer;
  40.   wx2,wy2        : integer;
  41.  
  42.   retcode        : integer;
  43.   key            : char;
  44.  
  45.   buffer         : array[1..bufmax] of byte;
  46.  
  47. {**********}
  48.  
  49. begin
  50.  
  51.   { Display program header }
  52.   writeln;
  53.   writeln('╒══════════════════════════════════════════════════════════════════════════╕');
  54.   writeln('│ fxTest: Example Effect Pascal Program                   PCX Effects 1.0x │');
  55.   writeln('│ Copyright (c) Genus Microprogramming, Inc. 1988-89  All Rights Reserved. │');
  56.   writeln('╘══════════════════════════════════════════════════════════════════════════╛');
  57.   writeln;
  58.  
  59.   { Get a key, to begin }
  60.   writeln('Press a key to run . . .');
  61.   key := ReadKey;
  62.  
  63.   { Allocate a larter toolkit buffer, to speed up file and display speeds }
  64.   retcode := pcxSetBuffer(@buffer,bufmax);
  65.  
  66.   { Check if we have expanded memory, and display }
  67.   if (pcxEMInstalled = pcxSUCCESS) then begin
  68.     vfree := pcxVirtualFree(pcxEMM);
  69.     writeln('Free EMM: ',vfree);
  70.   end; {of if}
  71.  
  72.   { Display the amount of conventional free memory }
  73.   vfree := pcxVirtualFree(pcxCMM);
  74.   writeln('Free CMM: ',vfree);
  75.  
  76.   { Look at the current hardware, to find a B/W mode }
  77.   retcode := pcxVideoInfo(@vi);
  78.  
  79.   case vi[1].adapter of
  80.     viCGA: pcxtype := pcxCGA_6;
  81.     viEGA: begin
  82.              if (vi[1].display = viMDAdisp) then
  83.                pcxtype := pcxEGA_F
  84.              else
  85.                pcxtype := pcxEGA_10;
  86.            end;
  87.     viVGA: pcxtype := pcxVGA_11;
  88.     viHGC: pcxtype := pcxHERC;
  89.     else   pcxtype := -1;
  90.   end; {of case}
  91.  
  92.   { If we found a mode, continue }
  93.   if (pcxtype <> -1) then begin
  94.  
  95.     { Set the display type }
  96.     retcode := pcxSetDisplay(pcxtype);
  97.  
  98.     { Load the image }
  99.     retcode := fxFileImage(pcxCMM,@vptr,pcximage);
  100.     if (retcode = fxSUCCESS) then begin
  101.  
  102.       { Change to graphics mode }
  103.       retcode := pcxSetMode(pcxGRAPHICS);
  104.  
  105.       { Calibrate the delay timer, and play a looping song }
  106.       retcode := fxCalibrateDelay;
  107.       retcode := fxPlayLoop(25);
  108.       retcode := fxPlay('T120 MB O3 L32 C D E F G A B A G F E D ');
  109.  
  110.       { Select our effect }
  111.       retcode := fxSetEffect(fxRANDOM);
  112.       retcode := fxSetGrain(8);
  113.  
  114.       { and do it }
  115.       retcode := fxVirtualEffect(vptr,0,0,fxNONE);
  116.  
  117.       { Kill any remaining background music }
  118.       retcode := fxPlayKill;
  119.  
  120.       { Wait for a key }
  121.       key := ReadKey;
  122.  
  123.       { Get back to text mode }
  124.       retcode := pcxSetMode(pcxTEXT);
  125.  
  126.       { Were we successful? }
  127.       if (retcode <> fxSUCCESS) then
  128.         writeln('pcxVirtualEffect Error: ',retcode);
  129.  
  130.       { Destroy the image }
  131.       retcode := fxFreeImage(vptr);
  132.  
  133.     end
  134.     else begin
  135.       { Could not load image }
  136.       writeln('Could not load image: ',retcode);
  137.     end;
  138.  
  139.   end
  140.   else begin
  141.     { We could not find a good mode }
  142.     writeln('Could not find a good mode type . . .');
  143.   end; {of else}
  144.  
  145. end. { end of main }
  146.  
  147.