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 >
Wrap
BASIC Source File
|
1994-10-09
|
9KB
|
196 lines
'*************************************************************************
'
' Demo_IMG.Bas Copyright 1994 Rob W. Smetana
'
' Be SURE to (L)oad "Disp_IMG.Bas" -- with our psDisplayDATA routine.
'
' PowerBASIC users: 1. Load Disp_IMG.Bas, then compile it to a
' ^^^^^^^^^^ unit -- to Disp_IMG.PBU. BE SURE to un-rem
' the "PUBLIC" statements BEFORE compiling it!
'
' 2. THEN, un-REM some lines below.
'*****************************
' This demonstrates:
'*****************************
' 1. How to display P-Screen's IMAGE data screens -- easily and quickly!
'
' 2. How to use 2 procedures we include to display IMAGE data screens:
'
' psDisplayDATA (BASIC version: UNCOMPRESSED screens ONLY)
'
' psRestScrn (ASM version: compressed -OR- uncompressed screens)
'
' NOTE: psDisplayData is in Disp_Img.Bas. You MUST load that too
' to run this.
'
' Disp_Img.Bas ALSO contains psPaint to PAINT areas of the screen.
'
' REQUIRES:
'
' 1. PScreen.OBJ (QB/PDS/VBDOS users -- load a quick library)
' (PowerBASIC users -- un-REM the lines below)
'
' 2. psDisplayDATA (Load Disp_Scr.Bas -- Alt-F ... Load)
' (PowerBASIC users, compile and $LINK "Disp_IMG.PBU")
'
'
' The DATA statements below contain our IMAGE data screens. These
' "partial" screens were saved by P-Screen when we marked the areas
' of the screen we wanted to save. We saved them in UN-compressed form!
'
' We then just merged the ".IMG" files into this file, and added code
' to display them -- note how e-a-s-y it is to display image data screens.
'
' NOTES:
'
' 1. P-Screen saved "Screen Coordinates" with our screens.
' They tell us where the screen was when we marked it
' and told P-Screen to save it (e.g., 1, 1, 25, 80 for
' a full 25-row by 80-column screen).
'
' Pass these screen coordinates to both psDisplayScreen
' and psRestScrn to display the screen. We can pass these
' either as variables (TopRow = 1) or as absolute values.
'
' 2. You can easily CHANGE where screens appear by changing
' screen coordinates (except with full screens).
'
' Just BE SURE to add the SAME constant to both TopRow
' and BottomRow, and the SAME constant to both LeftCol
' and RightCol -- see the 2nd example below.
'
'************************************************************************
DEFINT A-Z
' $INCLUDE: 'PSCREEN.INC' '...declare our functions
'************************************************************************
'***************************************************
' POWERBASIC USERS: 'un-REM the next lines
' 'see the notes above first
'***************************************************
''$INCLUDE "PScreen.Inc" '...declare routines
''$Link "PScreen.Obj" '...ASM screen display routine
''$Link "Disp_IMG.PBU" '...contains psDisplayData & psPaint
'***************************************************
' END: POWERBASIC USERS
'***************************************************
'***************************************************
'* Here's an IMAGE data screen saved by P-Screen. *
'* We just MERGED the ".IMG" file P-Screen saved. *
'***************************************************
MainMenu: '...a 1-line main menu screen
' Screen Coordinates (and ArraySize):
DATA 1, 1, 1, 80, 80
DATA 13552,12320,12543,13382,12393,12396,12389,12320,12320,12320
DATA 12320,12543,13380,12402,12385,12407,12320,12320,12320,12320
DATA 12543,13378,12396,12399,12387,12395,12320,12320,12320,12320
DATA 12543,13381,12388,12393,12404,12320,12320,12320,12320,12543
DATA 13391,12400,12404,12393,12399,12398,12403,12320,12320,12320
DATA 12320,12320,13384,12389,12396,12400,12320,12320,12320,12320
DATA 12320,12320,12320,12320,12320,12320,12320,12320,12320,12320
DATA 12320,12320,12320,12320,12320,12320,12320,12320,12320,12320
'**************************************************
'* Another IMAGE data screen saved by P-Screen. *
'**************************************************
WELCOM2DATA: '...a small "welcome" window
' Screen Coordinates (and ArraySize):
DATA 1,1,10,24, 240
DATA 7130,7108,7108,7108,7108,7108,7108,7108,7108,7108
DATA 7108,7108,7108,7108,7108,7108,7108,7108,7108,7108
DATA 7108,7108,7108,7103,7091,6944,2592,2592,2592,2592
DATA 2592,2592,2592,2592,2592,2592,2592,3104,3104,3104
DATA 3104,3104,3104,3104,3104,3104,6944,7091,7091,6944
DATA 2647,2661,2668,2659,2671,2669,2661,2592,3188,3183
DATA 2592,2640,2605,2643,2659,2674,2661,2661,2670,2593
DATA 6944,7091,7091,6944,2592,2592,2592,2592,2592,2592
DATA 2592,2592,2592,2592,2592,2592,2592,2592,2592,2592
DATA 2592,2592,2592,2592,6944,7091,7091,6944,2848,2903
DATA 2917,2848,2920,2927,2928,2917,2848,2937,2927,2933
DATA 2848,2918,2921,2926,2916,2848,2921,2676,6944,7091
DATA 7091,6944,2848,2848,2913,2931,2848,2933,2931,2917
DATA 2918,2933,2924,2848,2921,2926,2848,2937,2927,2933
DATA 2930,2592,6944,7091,7091,6944,2848,2848,2935,2927
DATA 2930,2923,2848,2913,2931,2848,2935,2917,2848,2916
DATA 2927,2848,2921,2926,2848,2592,6944,7091,7091,6944
DATA 2848,2848,2927,2933,2930,2848,2927,2935,2926,2862
DATA 2848,2848,3141,3182,3178,3183,3193,3105,3104,2592
DATA 6944,7091,7091,6944,2848,2848,2848,2848,2848,2848
DATA 2848,2848,2848,2848,2848,2848,2848,2848,2848,2848
DATA 2848,2848,2848,2592,6944,7091,7104,7108,7108,7108
DATA 7108,7108,7108,7108,7108,7108,7108,7108,7108,7108
DATA 7108,7108,7108,7108,7108,7108,7108,7108,7108,7129
'****************************************************
'* Note how e-a-s-y it is to display IMAGE screens. *
'* We'll display the menu screen TWICE, using both *
'* psDisplayDATA -and- psRestScrn *
'****************************************************
COLOR 7, 1: CLS
Call psInitialize '...for SHAREWARE versions only
cls
'***************************************************
'* Begin by READing our screen data into an array. *
'***************************************************
'...This "Restore" helps ensure we always start
' at the beginning of our screen DATA statements.
RESTORE MainMenu
'...read screen coordinates -- for our 1-line "Main Menu" screen
READ TRow, LCol, BRow, RCol, ArraySize
REDIM ScrArr(1 TO ArraySize)
'...read screen data into the array
FOR x = 1 TO ArraySize: READ ScrArr(x): NEXT
'...read data for our "Welcome" screen
RESTORE WELCOM2DATA
READ WelcomeTRow, WelcomeLCol, WelcomeBRow, WelcomeRCol, WelcomeSize
REDIM WelcomeARR(1 TO WelcomeSize)
FOR x = 1 TO WelcomeSize: READ WelcomeARR(x): NEXT
'***************************************************************
' 1st, display it at the top of the screen -- using variables.
' psDisplayDATA handles ONLY uncompressed screens!
'***************************************************************
Attribute = 0 '...do NOT shadow our 1-line screen
CALL psDisplayData(TRow, LCol, BRow, RCol, ScrArr(), Attribute)
'***************************************************************
' Now use psRestScrn to display it NEAR the BOTTOM -- by
' adding the SAME constant to BOTH TopRow and BottomRow.
' Notice we'll use absolute values for screen coordinates
' instead of variables.
'
'...psRestScrn handles compressed -or- uncompressed screens!
'***************************************************************
CALL psRestScrn(1 + 24, 1, 1 + 24, 80, SEG ScrArr(1))
'***************************************************************
' Finally, display our "welcome" screen until you PRESS A KEY!
'
' We'll display this RANDOMLY, shadowing it on EVEN # displays.
'***************************************************************
RANDOMIZE TIMER
NumRows = WelcomeBRow - WelcomeTRow
NumCols = WelcomeRCol - WelcomeLCol
LowestRow = 25 - NumRows - 1
LastCol = 80 - NumCols - 1
DO
WelcomeTRow = INT((TRow + 2 - LowestRow - 1) * RND + LowestRow)
WelcomeLCol = INT((LCol + 1 - LastCol - 1) * RND + LastCol)
IF (WelcomeTRow MOD 2) = 0 THEN Attribute = 8 ELSE Attribute = 0
CALL psDisplayData(WelcomeTRow, WelcomeLCol, WelcomeTRow + NumRows, WelcomeLCol + NumCols, WelcomeARR(), Attribute)
LOOP UNTIL LEN(INKEY$)