home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
B_TILES.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
5KB
|
99 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME B_TILES .DMO ║ by ╘════════════════─ ║ ║
│ │ LIBRARY ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
For an exciting background, box filler, or a plythora of boxes this routine
just can't be beat! The demo shows how to create a block of 256 boxes with
one call! The whole grid could then be treated as one event box with a
quick computation as to which row/col the mouse "HIT" at and you have the
ASCII value of the box!
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
'┌───────────────────────
$INCLUDE "DAS-NB01.INC" '│
$INCLUDE "DAS-NBV1.INC" '│
$INCLUDE "DAS-NBV2.INC" '│
'│
CLS '│ get the VGA screen
SCREEN 12 '│ set-up
GraphicSETUP '│
fLoadDAScolor '│ load 3D color system
'│
C? = 3 '│ print the HEX numbers
FOR R? = 2 TO 17 '│ both horizontal
L$ = MID$( " 0123456789ABCDEF",R?, 1 ) '│ and vertical
LOCATE R?, 1 : PRINT L$ '│
LOCATE 1, C? : PRINT L$ '│
INCR C?, 2 '│
NEXT '│
GBoxTILES 12, 15, 268, 271, 3, 8, 13, 16, 16 '│ draw 256 16x16 boxes
'│
DO '│ menu loop
LOCATE 18, 3 : PRINT "BOX: &h"; fHEX$( Box%, 1 ) '│ report on box #
X1% = ( ( Box% MOD 16 ) * 16 ) + 12 '│ compute X,Y coords
Y1% = ( ( Box% \ 16 ) * 16 ) + 15 '│
X2% = X1% + 15 '│
Y2% = Y1% + 15 '│
GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 3, 4 '│ color hot box yellow
GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 8, 9 '│
GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 13, 14 '│
G$ = fANYkey$ '│ get a key
GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 4, 3 '│ color hot box blue
GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 9, 8 '│
GBoxCOLOR2 X1%, Y1%, X2%, Y2%, 14, 13 '│
SELECT CASE G$ '│ select key-action
CASE CHR$(27) '│ <ESC> bail out
EXIT LOOP '│
CASE CHR$(0,72) '│ <UP>
IF Box% > 15 THEN DECR Box%, 16 '│
CASE CHR$(0,75) '│ <LEFT>
IF ( Box% MOD 16 ) > 0 THEN DECR Box%, 1 '│
CASE CHR$(0,77) '│ <RIGHT>
IF ( Box% MOD 16 ) < 15 THEN INCR Box%, 1 '│
CASE CHR$(0,80) '│ <LEFT>
IF Box% < 240 THEN INCR Box%, 16 '│
END SELECT '│
LOOP '│
'│
'│
CLS : PALETTE : SCREEN 0 : END '│
'└───────────────────────
SUB GBoxTiles2( BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%, _
BYVAL BXa?, BYVAL TLa?, BYVAL BRa?, BYVAL Wide%, BYVAL High% ) LOCAL PUBLIC
LOCAL X%, Y%, Z%
GBoxCOLOR X1%, Y1%, X2%, Y2%, BXa?
FOR X% = X1% TO X2%-1 STEP Wide%
Z% = ( X%+1 ) : GLineDRAW Z%, Y1%, Z%, Y2%, 0, 3, TLa?
Z% = ( X%+Wide%-1) : GLineDRAW Z%, Y1%, Z%, Y2%, 0, 3, BRa?
NEXT
FOR Y% = Y1% TO Y2%-1 STEP High%
GLineDRAW X1%, Y%, X2%, Y%, 0, 3, 15
Z% = ( Y%+1 ) : GLineDRAW X1%, Z%, X2%, Z%, 0, 3, TLa?
Z% = ( Y%+High%-1) : GLineDRAW X1%, Z%, X2%, Z%, 0, 3, BRa?
NEXT
FOR X% = X1% TO X2% STEP Wide%
GLineDRAW X%, Y1%, X%, Y2%, 0, 3, 15
NEXT
GLineDRAW X1%, Y2%, X2%, Y2%, 0, 3, 15
END SUB