home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 18 / CD_ASCQ_18_111294_W.iso / dos / prg / pas / pscrn55 / basic.exe / DEMO_IMG.BAS next >
BASIC Source File  |  1994-10-09  |  9KB  |  196 lines

  1. '*************************************************************************
  2. '
  3. '  Demo_IMG.Bas                         Copyright 1994 Rob W. Smetana
  4. '
  5. '  Be SURE to (L)oad "Disp_IMG.Bas" -- with our psDisplayDATA routine.
  6. '
  7. '  PowerBASIC users:  1. Load Disp_IMG.Bas, then compile it to a
  8. '  ^^^^^^^^^^            unit -- to Disp_IMG.PBU.  BE SURE to un-rem
  9. '                        the "PUBLIC" statements BEFORE compiling it!
  10. '
  11. '                     2. THEN, un-REM some lines below.
  12. '*****************************
  13. '  This demonstrates:
  14. '*****************************
  15. '   1. How to display P-Screen's IMAGE data screens -- easily and quickly!
  16. '
  17. '   2. How to use 2 procedures we include to display IMAGE data screens:
  18. '
  19. '      psDisplayDATA   (BASIC version:  UNCOMPRESSED screens ONLY)
  20. '
  21. '      psRestScrn      (ASM version: compressed -OR- uncompressed screens)
  22. '
  23. '  NOTE:  psDisplayData is in Disp_Img.Bas.  You MUST load that too
  24. '         to run this.
  25. '
  26. '         Disp_Img.Bas ALSO contains psPaint to PAINT areas of the screen.
  27. '
  28. '  REQUIRES:
  29. '
  30. '   1.  PScreen.OBJ     (QB/PDS/VBDOS users -- load a quick library)
  31. '                       (PowerBASIC users   -- un-REM the lines below)
  32. '
  33. '   2.  psDisplayDATA   (Load Disp_Scr.Bas -- Alt-F ... Load)
  34. '                       (PowerBASIC users, compile and $LINK "Disp_IMG.PBU")
  35. '
  36. '
  37. '  The DATA statements below contain our IMAGE data screens.  These
  38. '  "partial" screens were saved by P-Screen when we marked the areas
  39. '  of the screen we wanted to save.  We saved them in UN-compressed form!
  40. '
  41. '  We then just merged the ".IMG" files into this file, and added code
  42. '  to display them -- note how e-a-s-y it is to display image data screens.
  43. '
  44. '  NOTES:
  45. '
  46. '   1.  P-Screen saved "Screen Coordinates" with our screens.
  47. '       They tell us where the screen was when we marked it
  48. '       and told P-Screen to save it (e.g., 1, 1, 25, 80 for
  49. '       a full 25-row by 80-column screen).
  50. '
  51. '       Pass these screen coordinates to both psDisplayScreen
  52. '       and psRestScrn to display the screen.  We can pass these
  53. '       either as variables (TopRow = 1) or as absolute values.
  54. '
  55. '   2.  You can easily CHANGE where screens appear by changing
  56. '       screen coordinates (except with full screens).
  57. '
  58. '       Just BE SURE to add the SAME constant to both TopRow
  59. '       and BottomRow, and the SAME constant to both LeftCol
  60. '       and RightCol -- see the 2nd example below.
  61. '
  62. '************************************************************************
  63.  
  64. DEFINT A-Z
  65.  
  66. ' $INCLUDE: 'PSCREEN.INC'       '...declare our functions
  67.  
  68. '************************************************************************
  69.  
  70. '***************************************************
  71. '   POWERBASIC USERS:  'un-REM the next lines
  72. '                      'see the notes above first
  73. '***************************************************
  74. ''$INCLUDE "PScreen.Inc"    '...declare routines
  75. ''$Link    "PScreen.Obj"    '...ASM screen display routine
  76. ''$Link    "Disp_IMG.PBU"   '...contains psDisplayData & psPaint
  77. '***************************************************
  78. '   END:  POWERBASIC USERS
  79. '***************************************************
  80.  
  81. '***************************************************
  82. '* Here's an IMAGE data screen saved by P-Screen.  *
  83. '* We just MERGED the ".IMG" file P-Screen saved.  *
  84. '***************************************************
  85.  
  86. MainMenu:        '...a 1-line main menu screen
  87. '   Screen Coordinates (and ArraySize):
  88. DATA 1, 1, 1, 80, 80
  89. DATA 13552,12320,12543,13382,12393,12396,12389,12320,12320,12320
  90. DATA 12320,12543,13380,12402,12385,12407,12320,12320,12320,12320
  91. DATA 12543,13378,12396,12399,12387,12395,12320,12320,12320,12320
  92. DATA 12543,13381,12388,12393,12404,12320,12320,12320,12320,12543
  93. DATA 13391,12400,12404,12393,12399,12398,12403,12320,12320,12320
  94. DATA 12320,12320,13384,12389,12396,12400,12320,12320,12320,12320
  95. DATA 12320,12320,12320,12320,12320,12320,12320,12320,12320,12320
  96. DATA 12320,12320,12320,12320,12320,12320,12320,12320,12320,12320
  97.  
  98. '**************************************************
  99. '* Another IMAGE data screen saved by P-Screen.   *
  100. '**************************************************
  101. WELCOM2DATA:     '...a small "welcome" window
  102. '   Screen Coordinates (and ArraySize):
  103. DATA 1,1,10,24, 240
  104. DATA 7130,7108,7108,7108,7108,7108,7108,7108,7108,7108
  105. DATA 7108,7108,7108,7108,7108,7108,7108,7108,7108,7108
  106. DATA 7108,7108,7108,7103,7091,6944,2592,2592,2592,2592
  107. DATA 2592,2592,2592,2592,2592,2592,2592,3104,3104,3104
  108. DATA 3104,3104,3104,3104,3104,3104,6944,7091,7091,6944
  109. DATA 2647,2661,2668,2659,2671,2669,2661,2592,3188,3183
  110. DATA 2592,2640,2605,2643,2659,2674,2661,2661,2670,2593
  111. DATA 6944,7091,7091,6944,2592,2592,2592,2592,2592,2592
  112. DATA 2592,2592,2592,2592,2592,2592,2592,2592,2592,2592
  113. DATA 2592,2592,2592,2592,6944,7091,7091,6944,2848,2903
  114. DATA 2917,2848,2920,2927,2928,2917,2848,2937,2927,2933
  115. DATA 2848,2918,2921,2926,2916,2848,2921,2676,6944,7091
  116. DATA 7091,6944,2848,2848,2913,2931,2848,2933,2931,2917
  117. DATA 2918,2933,2924,2848,2921,2926,2848,2937,2927,2933
  118. DATA 2930,2592,6944,7091,7091,6944,2848,2848,2935,2927
  119. DATA 2930,2923,2848,2913,2931,2848,2935,2917,2848,2916
  120. DATA 2927,2848,2921,2926,2848,2592,6944,7091,7091,6944
  121. DATA 2848,2848,2927,2933,2930,2848,2927,2935,2926,2862
  122. DATA 2848,2848,3141,3182,3178,3183,3193,3105,3104,2592
  123. DATA 6944,7091,7091,6944,2848,2848,2848,2848,2848,2848
  124. DATA 2848,2848,2848,2848,2848,2848,2848,2848,2848,2848
  125. DATA 2848,2848,2848,2592,6944,7091,7104,7108,7108,7108
  126. DATA 7108,7108,7108,7108,7108,7108,7108,7108,7108,7108
  127. DATA 7108,7108,7108,7108,7108,7108,7108,7108,7108,7129
  128.  
  129. '****************************************************
  130. '* Note how e-a-s-y it is to display IMAGE screens. *
  131. '* We'll display the menu screen TWICE, using both  *
  132. '*         psDisplayDATA -and- psRestScrn           *
  133. '****************************************************
  134.  
  135.     COLOR 7, 1: CLS
  136.     Call psInitialize                   '...for SHAREWARE versions only
  137.     cls
  138.     '***************************************************
  139.     '* Begin by READing our screen data into an array. *
  140.     '***************************************************
  141.  
  142.     '...This "Restore" helps ensure we always start
  143.     '   at the beginning of our screen DATA statements.
  144.     RESTORE MainMenu
  145.  
  146.     '...read screen coordinates -- for our 1-line "Main Menu" screen
  147.     READ TRow, LCol, BRow, RCol, ArraySize
  148.  
  149.     REDIM ScrArr(1 TO ArraySize)
  150.  
  151.     '...read screen data into the array
  152.     FOR x = 1 TO ArraySize: READ ScrArr(x): NEXT
  153.  
  154.     '...read data for our "Welcome" screen
  155.     RESTORE WELCOM2DATA
  156.     READ WelcomeTRow, WelcomeLCol, WelcomeBRow, WelcomeRCol, WelcomeSize
  157.     REDIM WelcomeARR(1 TO WelcomeSize)
  158.     FOR x = 1 TO WelcomeSize: READ WelcomeARR(x): NEXT
  159.  
  160.     '***************************************************************
  161.     ' 1st, display it at the top of the screen -- using variables.
  162.     ' psDisplayDATA handles ONLY uncompressed screens!
  163.     '***************************************************************
  164.     Attribute = 0       '...do NOT shadow our 1-line screen
  165.     CALL psDisplayData(TRow, LCol, BRow, RCol, ScrArr(), Attribute)
  166.  
  167.     '***************************************************************
  168.     ' Now use psRestScrn to display it NEAR the BOTTOM -- by
  169.     ' adding the SAME constant to BOTH TopRow and BottomRow.
  170.     ' Notice we'll use absolute values for screen coordinates
  171.     ' instead of variables.
  172.     '
  173.     '...psRestScrn handles compressed -or- uncompressed screens!
  174.     '***************************************************************
  175.     CALL psRestScrn(1 + 24, 1, 1 + 24, 80, SEG ScrArr(1))
  176.  
  177.     '***************************************************************
  178.     ' Finally, display our "welcome" screen until you PRESS A KEY!
  179.     '
  180.     ' We'll display this RANDOMLY, shadowing it on EVEN # displays.
  181.     '***************************************************************
  182.  
  183.     RANDOMIZE TIMER
  184.     NumRows = WelcomeBRow - WelcomeTRow
  185.     NumCols = WelcomeRCol - WelcomeLCol
  186.     LowestRow = 25 - NumRows - 1
  187.     LastCol = 80 - NumCols - 1
  188.     DO
  189.        WelcomeTRow = INT((TRow + 2 - LowestRow - 1) * RND + LowestRow)
  190.        WelcomeLCol = INT((LCol + 1 - LastCol - 1) * RND + LastCol)
  191.        IF (WelcomeTRow MOD 2) = 0 THEN Attribute = 8 ELSE Attribute = 0
  192.        CALL psDisplayData(WelcomeTRow, WelcomeLCol, WelcomeTRow + NumRows, WelcomeLCol + NumCols, WelcomeARR(), Attribute)
  193.  
  194.     LOOP UNTIL LEN(INKEY$)
  195.  
  196.