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

  1. '* fxTest.BAS                                                               *'
  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. ' Basic routine for the PCX Effects Toolkit.                                 '
  8. '                                                                            '
  9. ' To Compile: QuickBasic  4.x    QB   fxtest   /lpcxfx_qb.qlb                '
  10. '                                (press "Shift-F5" to run)                   '
  11. '                          or    BC   fxtest   /o;                           '
  12. '                                LINK fxtest,,,pcx_qb fx_qb;                 '
  13. '                                                                            '
  14. ' Microsoft Basic 6.0                     Programmer: Chris Howard  5/07/89  '
  15. '                                                                            '
  16. '****************************************************************************'
  17.  
  18. ' Include the PCX Toolkit and PCX Effects defines
  19. '$INCLUDE: 'pcxlib.bas'
  20. '$INCLUDE: 'fxlib.bas'
  21.  
  22. ' Globals
  23. pcxtype% = pcxVGA.11
  24. pcximage$ = "fxTest.PCX"
  25. retcode% = -999
  26.  
  27. DIM vi(2) AS PCXVINFO
  28.  
  29. DIM header AS PCXHEADER
  30.  
  31. CONST bufmax% = 20000
  32. DIM buffer%(bufmax% / 2)
  33.  
  34. '**********
  35.  
  36. main:
  37.  
  38.   ' Display program header
  39.   PRINT
  40.   PRINT "╒══════════════════════════════════════════════════════════════════════════╕"
  41.   PRINT "│ fxTest: Example Effect Basic Program                    PCX Effects 1.0x │"
  42.   PRINT "│ Copyright (c) Genus Microprogramming, Inc. 1988-89  All Rights Reserved. │"
  43.   PRINT "╘══════════════════════════════════════════════════════════════════════════╛"
  44.   PRINT
  45.  
  46.   ' Get a key, to begin
  47.   PRINT "Press a key to run . . ."
  48.   DO
  49.   LOOP WHILE INKEY$ = ""
  50.   PRINT
  51.  
  52.   ' Allocate a larger toolkit buffer, to speed up file and display speed.
  53.   retcode% = pcxSetBuffer%(buffer%(0), bufmax%)
  54.  
  55.   ' Free some conventional memory, using BASIC's SETMEM function
  56.   prevmem = SETMEM(-64000)
  57.  
  58.   ' Check if we have expanded memory, and display
  59.   IF (pcxEMInstalled% = pcxTRUE) THEN
  60.     vfree& = pcxVirtualFree&(pcxEMM)
  61.     PRINT "Free EMM: "; vfree&
  62.   END IF
  63.  
  64.   ' Display the amoung of conventional free memory
  65.   vfree& = pcxVirtualFree&(pcxCMM)
  66.   PRINT "Free CMM: "; vfree&
  67.  
  68.   ' Look at the current hardware, to find a B/W mode
  69.   retcode% = pcxVideoInfo%(vi(0))
  70.  
  71.   SELECT CASE (ASC(vi(0).adapter))
  72.     CASE viCGA
  73.       pcxtype% = pcxCGA.6
  74.     CASE viEGA
  75.       IF (ASC(vi(0).display) = viMDAdisp) THEN
  76.         pcxtype% = pcxEGA.F
  77.       ELSE
  78.         pcxtype% = pcxEGA.10
  79.       END IF
  80.     CASE viVGA
  81.       pcxtype% = pcxVGA.11
  82.     CASE viHGC
  83.       pcxtype% = pcxHERC
  84.     CASE ELSE
  85.       pcxtype% = -1
  86.   END SELECT
  87.  
  88.   ' If we found a mode, continue
  89.   IF (pcxtype% <> -1) THEN
  90.  
  91.     ' Set the display type
  92.     retcode% = pcxSetDisplay%(pcxCGA.6)
  93.  
  94.     ' Load the image
  95.     retcode% = fxFileImage%(pcxCMM, vptr&, pcximage$)
  96.     IF (retcode% = fxSUCCESS) THEN
  97.  
  98.       ' Change to graphics mode
  99.       retcode% = pcxSetMode(pcxGRAPHICS)
  100.  
  101.       ' Calibrate the delay timer, and play a looping song
  102.       retcode% = fxCalibrateDelay%
  103.       retcode% = fxPlayLoop%(25)
  104.       retcode% = fxPlay%("T120 MB O3 L32 C D E F G A B A G F E D ")
  105.  
  106.       ' Select our effect
  107.       retcode% = fxSetEffect%(fxRANDOM)
  108.       retcode% = fxSetGrain%(8)
  109.  
  110.       ' and do it
  111.       retcode% = fxVirtualEffect%(vptr&, 0, 0, fxNONE)
  112.  
  113.       ' Kill any remaining background music
  114.       retcode% = fxPlayKill%
  115.  
  116.       ' Wait for a key
  117.       DO
  118.       LOOP WHILE INKEY$ = ""
  119.  
  120.       ' Get back to text mode
  121.       retcode% = pcxSetMode%(pcxTEXT)
  122.  
  123.       ' Destroy the image
  124.       retcode% = fxFreeImage%(vptr&)
  125.  
  126.     ELSE
  127.       ' Could not load image
  128.       PRINT "Could not load image: "; retcode%
  129.     END IF
  130.  
  131.   ELSE
  132.     ' We could not find a good mode
  133.     PRINT "Could not find a good mode type . . ."
  134.   END IF
  135.  
  136. END 'end of main
  137.  
  138.