home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 13.55 Spreading Curtain Effect
- Author: Greg Lief
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- //───── NOTE: must compile with the /N option!
-
- #include "box.ch"
- #include "fileio.ch"
-
- #xtranslate drawbox( <color>, <t>, <l>, <b>, <r>, <fill> ) => ;
- dispbox(<t>, <l>, <b>, <r>, B_SINGLE + <fill>, <color>)
-
- #define TEST // remove this if you don't want the test code compiled
-
- // begin stub test program
-
- #ifdef TEST
-
- /*
- Function: CURTAINS()
- Purpose: Demonstrate spreading curtains effect
- */
- function Curtains
- local x
- dispbegin()
- setcursor(0)
- drawbox('w/b', 0, 0, maxrow(), maxcol(), ' ')
- drawbox('w/r', 5, 5, 19, 74, ' ')
- drawbox('w/rb', 9, 15, 16, 64, ' ')
- drawbox('n/bg', 11, 24, 14, 55, ' ')
- @ 12, 32 say "The Killer App" color 'n/bg'
- @ 13, 26 say "Copyright (c) 1991 Joe Blow" color 'n/bg'
- save_drape('title.scr')
- setcolor('w/n')
- cls
- dispend()
- pull_drape('title.scr')
- inkey(0)
- return nil
-
- #endif
-
-
- /*
- Function: PULL_DRAPE()
- Purpose: Draw title screen from specified memory file
- Excerpted from the Grumpfish Library
- Copyright (c) 1988-91 Greg Lief
- */
- function Pull_Drape(cfile)
- local nhandle, screen_ := {}, buffer, xx, yy, midpoint, ;
- mwidth, mlength, oldcurs := setcursor(0), ndelay := 10
- if file(cfile)
- if ( nhandle := fopen(cfile, FO_READ) ) != -1
- mwidth := ( maxrow() + 1 ) * 2
- buffer := space(mwidth)
- for xx := 1 to maxcol() + 1
- fread(nhandle, @buffer, mwidth)
- aadd(screen_, buffer)
- next
- fclose(nhandle)
- midpoint := int((maxcol() + 1) / 2) + 1
- for xx := midpoint to maxcol() + 1
- restscreen(0, xx - 1, maxrow(), xx - 1, screen_[xx])
- restscreen(0, maxcol() + 1 - xx, maxrow(), ;
- maxcol() + 1 - xx, screen_[maxcol() + 2 - xx])
- for yy := 1 to ndelay
- next
- next
- endif
- endif
- setcursor(oldcurs)
- return NIL
-
- * end function Pull_Drape()
- *---------------------------------------------------------------*
-
-
- /*
- Function: SAVE_DRAPE()
- Purpose: Save title screen to specified memory file
- Excerpted from the Grumpfish Library
- Copyright (c) 1988-91 Greg Lief
- */
- function save_drape(cfile)
- local buffer, nhandle := fcreate(cfile), xx, ret_val := .f.
- if ferror() == 0
- ret_val := .t.
- for xx := 0 to maxcol()
- buffer := savescreen(0, xx, maxrow(), xx)
- if fwrite(nhandle, buffer) != ( maxrow() + 1) * 2
- ret_val := .f.
- exit
- endif
- next
- fclose(nhandle)
- endif
- return ret_val
-
- * end function Save_Drape()
- *---------------------------------------------------------------*
-
- // end of file CHP1355.PRG
-