home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c011 / 4.ddi / EXAMPLES / CLIPPER / FXTEST.PRG < prev   
Encoding:
Text File  |  1989-06-01  |  3.4 KB  |  136 lines

  1. * fxTest.PRG                                                                *
  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. * Nantucket Clipper                       Programmer: Chris Howard  5/07/89 *
  10. *                                                                           *
  11. *****************************************************************************
  12.  
  13. * Include the PCX Toolkit defines
  14. SET PROCEDURE TO pcxlib
  15. DO  pcxInit
  16. * and PCX Effects
  17. SET PROCEDURE TO fxlib
  18. DO  fxInit
  19.  
  20. PRIVATE  pcximage,pcxtype
  21.  
  22. * Globals
  23. pcxtype  = pcxVGA_11
  24. pcximage = "fxTest.PCX"
  25.  
  26. bufmax   = 20000
  27. buffer   = SPACE(bufmax)
  28.  
  29. vi       = SPACE(4)
  30. header   = SPACE(128)
  31.  
  32. vptr     = SPACE(4)
  33.  
  34. **********
  35.  
  36. * Main
  37.  
  38.   * Display program header
  39.   ?
  40.   ? "╒══════════════════════════════════════════════════════════════════════════╕"
  41.   ? "│ fxTest: Example Effect Clipper Program                  PCX Effects 1.0x │"
  42.   ? "│ Copyright (c) Genus Microprogramming, Inc. 1988-89  All Rights Reserved. │"
  43.   ? "╘══════════════════════════════════════════════════════════════════════════╛"
  44.   ?
  45.  
  46.   * Allocate a larger toolkit buffer, to speed up file and display speed.
  47.   retcode = pcxSB(buffer,bufmax);
  48.  
  49.   * Check if we have expanded memory, and display
  50.   IF (PCXEMI() = pcxTRUE)
  51.     vfree = pcxVE(pcxEMM)
  52.     ? "Free EMM: ",vfree
  53.   ENDIF
  54.  
  55.   * Display the amount of conventional memory free
  56.   vfree = pcxVE(pcxCMM)
  57.   ? "Free CMM: ",vfree
  58.  
  59.   * Look at the current hardware, to find a B/W mode
  60.   pcxVI(vi)
  61.  
  62.   adapter = ASC(SUBSTR(vi,1,1))
  63.  
  64.   DO CASE
  65.     CASE adapter = viCGA
  66.       pcxtype = pcxCGA_6
  67.     CASE adapter = viEGA
  68.       IF (ASC(SUBSTR(vi,2,1)) = viMDAdisp)
  69.         pcxtype = pcxEGA_F
  70.       ELSE
  71.         pcxtype = pcxEGA_10
  72.       ENDIF
  73.     CASE adapter = viVGA
  74.       pcxtype = pcxVGA_11
  75.     CASE adapter = viHGC
  76.       pcxtype = pcxHERC
  77.     OTHERWISE
  78.       pcxtype = -1
  79.   ENDCASE
  80.  
  81.   * If we found a mode, continue
  82.   IF (pcxtype <> -1)
  83.  
  84.     * Set the display type
  85.     pcxSD(pcxtype)
  86.  
  87.     * Load the image 
  88.     retcode = fxFI(pcxCMM,vptr,pcximage)
  89.     IF (retcode = fxSUCCESS)
  90.  
  91.       * Change to graphics mode
  92.       pcxSM(pcxGRAPHICS)
  93.  
  94.       * Calibrate the delay timer, and play a looping song
  95.       fxCD()
  96.       fxPO(25)
  97.       fxPT("T120 MB O3 L32 C D E F G A B A G F E D ")
  98.  
  99.       * Select our effect
  100.       fxSE(fxRANDOM)
  101.       fxSG(8)
  102.  
  103.       * and do it
  104.       retcode = fxVE(vptr,0,0,fxNONE)
  105.     
  106.       * Kill any remaining background music
  107.       fxPK()
  108.     
  109.       * Wait for a key
  110.       INKEY(0)
  111.  
  112.       * Get back to text mode
  113.       pcxSM(pcxTEXT)
  114.  
  115.       * Were we successful?
  116.       IF (retcode <> fxSUCCESS)
  117.         ? "VirtualEffect Error: ",retcode
  118.       ENDIF
  119.  
  120.       * Free the image
  121.       fxFI(vptr)
  122.  
  123.     ELSE
  124.       * Cold not load image
  125.       ? "Could not load image: ",retcode
  126.     ENDIF
  127.  
  128.   ELSE
  129.     * We could not find a good mode
  130.     ? "Could not find a good mode type . . ."
  131.   ENDIF
  132.  
  133.  
  134. RETURN && Main
  135.  
  136.