home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP13.EXE / CHP1355.PRG < prev    next >
Encoding:
Text File  |  1991-06-12  |  2.9 KB  |  110 lines

  1. /*
  2.    Listing 13.55 Spreading Curtain Effect
  3.    Author: Greg Lief
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. //───── NOTE: must compile with the /N option!
  12.  
  13. #include "box.ch"
  14. #include "fileio.ch"
  15.  
  16. #xtranslate drawbox( <color>, <t>, <l>, <b>, <r>, <fill> ) => ;
  17.             dispbox(<t>, <l>, <b>, <r>, B_SINGLE + <fill>, <color>)
  18.  
  19. #define TEST    // remove this if you don't want the test code compiled
  20.  
  21. // begin stub test program
  22.  
  23. #ifdef TEST
  24.  
  25. /*
  26.      Function: CURTAINS()
  27.      Purpose:  Demonstrate spreading curtains effect
  28. */
  29. function Curtains
  30. local x
  31. dispbegin()
  32. setcursor(0)
  33. drawbox('w/b', 0, 0, maxrow(), maxcol(), ' ')
  34. drawbox('w/r', 5, 5, 19, 74, ' ')
  35. drawbox('w/rb', 9, 15, 16, 64, ' ')
  36. drawbox('n/bg', 11, 24, 14, 55, ' ')
  37. @ 12, 32 say "The Killer App" color 'n/bg'
  38. @ 13, 26 say "Copyright (c) 1991 Joe Blow" color 'n/bg'
  39. save_drape('title.scr')
  40. setcolor('w/n')
  41. cls
  42. dispend()
  43. pull_drape('title.scr')
  44. inkey(0)
  45. return nil
  46.  
  47. #endif
  48.  
  49.  
  50. /*
  51.      Function: PULL_DRAPE()
  52.      Purpose:  Draw title screen from specified memory file
  53.      Excerpted from the Grumpfish Library
  54.      Copyright (c) 1988-91 Greg Lief
  55. */
  56. function Pull_Drape(cfile)
  57. local nhandle, screen_ := {}, buffer, xx, yy, midpoint, ;
  58.       mwidth, mlength, oldcurs := setcursor(0), ndelay := 10
  59. if file(cfile)
  60.    if ( nhandle := fopen(cfile, FO_READ) ) != -1
  61.       mwidth := ( maxrow() + 1 ) * 2
  62.       buffer := space(mwidth)
  63.       for xx := 1 to maxcol() + 1
  64.          fread(nhandle, @buffer, mwidth)
  65.          aadd(screen_, buffer)
  66.       next
  67.       fclose(nhandle)
  68.       midpoint := int((maxcol() + 1) / 2) + 1
  69.       for xx := midpoint to maxcol() + 1
  70.          restscreen(0, xx - 1, maxrow(), xx - 1, screen_[xx])
  71.          restscreen(0, maxcol() + 1 - xx, maxrow(), ;
  72.                     maxcol() + 1 - xx, screen_[maxcol() + 2 - xx])
  73.          for yy := 1 to ndelay
  74.          next
  75.       next
  76.    endif
  77. endif
  78. setcursor(oldcurs)
  79. return NIL
  80.  
  81. * end function Pull_Drape()
  82. *---------------------------------------------------------------*
  83.  
  84.  
  85. /*
  86.      Function: SAVE_DRAPE()
  87.      Purpose:  Save title screen to specified memory file
  88.      Excerpted from the Grumpfish Library
  89.      Copyright (c) 1988-91 Greg Lief
  90. */
  91. function save_drape(cfile)
  92. local buffer, nhandle := fcreate(cfile), xx, ret_val := .f.
  93. if ferror() == 0
  94.    ret_val := .t.
  95.    for xx := 0 to maxcol()
  96.       buffer := savescreen(0, xx, maxrow(), xx)
  97.       if fwrite(nhandle, buffer) != ( maxrow() + 1) * 2
  98.          ret_val := .f.
  99.          exit
  100.       endif
  101.    next
  102.    fclose(nhandle)
  103. endif
  104. return ret_val
  105.  
  106. * end function Save_Drape()
  107. *---------------------------------------------------------------*
  108.  
  109. // end of file CHP1355.PRG
  110.