home *** CD-ROM | disk | FTP | other *** search
- '* fxTest.BAS *'
- '* Copyright (c) Genus Microprogramming, Inc. 1988-89 All Rights Reserved. *'
-
- '****************************************************************************'
- ' '
- ' This program demonstrates the usage of an effect. It is an example '
- ' Basic routine for the PCX Effects Toolkit. '
- ' '
- ' To Compile: QuickBasic 4.x QB fxtest /lpcxfx_qb.qlb '
- ' (press "Shift-F5" to run) '
- ' or BC fxtest /o; '
- ' LINK fxtest,,,pcx_qb fx_qb; '
- ' '
- ' Microsoft Basic 6.0 Programmer: Chris Howard 5/07/89 '
- ' '
- '****************************************************************************'
-
- ' Include the PCX Toolkit and PCX Effects defines
- '$INCLUDE: 'pcxlib.bas'
- '$INCLUDE: 'fxlib.bas'
-
- ' Globals
- pcxtype% = pcxVGA.11
- pcximage$ = "fxTest.PCX"
- retcode% = -999
-
- DIM vi(2) AS PCXVINFO
-
- DIM header AS PCXHEADER
-
- CONST bufmax% = 20000
- DIM buffer%(bufmax% / 2)
-
- '**********
-
- main:
-
- ' Display program header
- PRINT
- PRINT "╒══════════════════════════════════════════════════════════════════════════╕"
- PRINT "│ fxTest: Example Effect Basic Program PCX Effects 1.0x │"
- PRINT "│ Copyright (c) Genus Microprogramming, Inc. 1988-89 All Rights Reserved. │"
- PRINT "╘══════════════════════════════════════════════════════════════════════════╛"
- PRINT
-
- ' Get a key, to begin
- PRINT "Press a key to run . . ."
- DO
- LOOP WHILE INKEY$ = ""
- PRINT
-
- ' Allocate a larger toolkit buffer, to speed up file and display speed.
- retcode% = pcxSetBuffer%(buffer%(0), bufmax%)
-
- ' Free some conventional memory, using BASIC's SETMEM function
- prevmem = SETMEM(-64000)
-
- ' Check if we have expanded memory, and display
- IF (pcxEMInstalled% = pcxTRUE) THEN
- vfree& = pcxVirtualFree&(pcxEMM)
- PRINT "Free EMM: "; vfree&
- END IF
-
- ' Display the amoung of conventional free memory
- vfree& = pcxVirtualFree&(pcxCMM)
- PRINT "Free CMM: "; vfree&
-
- ' Look at the current hardware, to find a B/W mode
- retcode% = pcxVideoInfo%(vi(0))
-
- SELECT CASE (ASC(vi(0).adapter))
- CASE viCGA
- pcxtype% = pcxCGA.6
- CASE viEGA
- IF (ASC(vi(0).display) = viMDAdisp) THEN
- pcxtype% = pcxEGA.F
- ELSE
- pcxtype% = pcxEGA.10
- END IF
- CASE viVGA
- pcxtype% = pcxVGA.11
- CASE viHGC
- pcxtype% = pcxHERC
- CASE ELSE
- pcxtype% = -1
- END SELECT
-
- ' If we found a mode, continue
- IF (pcxtype% <> -1) THEN
-
- ' Set the display type
- retcode% = pcxSetDisplay%(pcxCGA.6)
-
- ' Load the image
- retcode% = fxFileImage%(pcxCMM, vptr&, pcximage$)
- IF (retcode% = fxSUCCESS) THEN
-
- ' 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
- DO
- LOOP WHILE INKEY$ = ""
-
- ' Get back to text mode
- retcode% = pcxSetMode%(pcxTEXT)
-
- ' Destroy the image
- retcode% = fxFreeImage%(vptr&)
-
- ELSE
- ' Could not load image
- PRINT "Could not load image: "; retcode%
- END IF
-
- ELSE
- ' We could not find a good mode
- PRINT "Could not find a good mode type . . ."
- END IF
-
- END 'end of main
-
-