home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
EVENT.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
6KB
|
161 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME EVENT .DMO ║ by ╘════════════════─ ║ ║
│ │ ║ 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 ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
$INCLUDE "KEYCODES.INC"
$INCLUDE "DAS-NB01.INC"
$INCLUDE "DAS-NB02.INC"
COLOR 7, 0
CLS
IF fMouseSETUP?( 0 ) = 0 THEN
PRINT "GOTTA HAVE A MOUSE!"
END
END IF
EventSETUP 5, 100
GOSUB TESTSCREEN
' ──────────────────────────────────────────────────────────────────────
fEventOpenT E1?(0,0), 3 ' simulate two previously
fEventOpenT E2?(0,0), 3 ' opened events #1 and #2
' ──────────────────────────────────────────────────────────────────────
MyEvent% = fEventOpenT%( E3?(0,0), 3 ) ' open "active" event
EventClear ' clear kbrd & mouse keys
MouseONnow ' turn on the mouse
Hit% = 1 ' 1st box (left most)
'
DO ' action loop
H% = ABS( Hit% ) ' old "hot" button
A? = 15 : GOSUB TBOXM ' turn "on" hot button
G% = fEventKey%( Hit%, "" ) ' await/get action
A? = 7 : GOSUB TBOXM ' turn "off" hot button
IF Hit% > 0 THEN EXIT LOOP ' BINGO! mouse clicked
IF Hit% < 0 THEN ITERATE ' MOUSE is down (hot)
Hit% = H% ' reset original value
SELECT CASE G% ' a key-press
CASE %ENTER_key : EXIT LOOP ' ENTER - Accept HOT
CASE %ESC_key : EXIT LOOP ' ESC - Bail out
CASE %MOUSE_DOWN : ' Another event is HOT
CASE %MOUSE_CLICK : BEEP ' Another event was HIT
CASE ELSE ' any other key advances
INCR Hit%, 1 ' the "hot" box
IF Hit% > 3 THEN Hit% = 1 '
END SELECT '
LOOP '
EventClose ' we now close our event
' and would exit the sub
' back to the calling
' routine who's event
MouseOFF ' is still in running
CLS '
END '
TBOXM:
MouseCoffT E3?(0,H%),E3?(1,H%),E3?(2,H%),E3?(3,H%) ' hot button ON/OFF
TBOX E3?(0,H%),E3?(1,H%),E3?(2,H%),E3?(3,H%),A? ' hot button ON/OFF
MouseON '
RETURN
' ──────────────────────────────────────────────────────────────────────────
FUNCTION fGetKey% () LOCAL PUBLIC
DO
IF INSTAT THEN
FUNCTION = CVI( INKEY$ + CHR$(0) )
EXIT FUNCTION
END IF
LOOP UNTIL fMouseGetKey% <> 0
B% = fMouseStatsT%( Row?, Col? )
LOCATE 24, 1 : PRINT USING "Button: ## Row: ## Col: ##"; B%, Row?, Col?
END FUNCTION
' ──────────────────────────────────────────────────────────────────────────
SUB TBOX( BYVAL Row?, BYVAL Col?, BYVAL Row2?, BYVAL Col2?, BYVAL Colour? ) LOCAL PUBLIC
LOCAL R?, Cols?
Cols? = Col2? - Col? + 1
COLOR Colour?
FOR R? = Row? TO Row2?
LOCATE R?, Col?
PRINT STRING$( Cols?, 219 )
INCR Row?, 1
NEXT
END SUB
' ──────────────────────────────────────────────────────────────────────────
' ───────────── LOCAL STUFF ─────────────────────────────────────────────
' ──────────────────────────────────────────────────────────────────────────
TESTSCREEN:
RESTORE EVENTDEMO
DIM E1?(3,3)
A? = 1
FOR B? = 0 TO 3
FOR E? = 0 TO 3
READ E1?(E?,B?)
NEXT
TBOX E1?(0,B?), E1?(1,B?), E1?(2,B?), E1?(3,B?), A?
A? = 7
NEXT
DIM E2?(3,3)
A? = 3
FOR B? = 0 TO 3
FOR E? = 0 TO 3
READ E2?(E?,B?)
NEXT
TBOX E2?(0,B?), E2?(1,B?), E2?(2,B?), E2?(3,B?), A?
A? = 0
NEXT
DIM E3?(3,3)
A? = 4
FOR B? = 0 TO 3
FOR E? = 0 TO 3
READ E3?(E?,B?)
NEXT
TBOX E3?(0,B?), E3?(1,B?), E3?(2,B?), E3?(3,B?), A?
A? = 7
NEXT
COLOR 15, 0
LOCATE 1, 60 : PRINT "EVENT #1 - BLUE"
LOCATE 2, 60 : PRINT "EVENT #2 - CYAN"
LOCATE 3, 60 : PRINT "EVENT #3 - RED"
RETURN
EVENTDEMO:
'EVENT BOX 1 (BLUE)
DATA 03, 03, 08, 41
DATA 05, 05, 06, 15
DATA 05, 17, 06, 27
DATA 05, 29, 06, 39
'EVENT BOX 2 (CYAN)
DATA 10, 03, 15, 41
DATA 12, 05, 13, 15
DATA 12, 17, 13, 27
DATA 12, 29, 13, 39
'EVENT BOX 3 (RED)
DATA 12, 38, 17, 76
DATA 14, 40, 15, 50
DATA 14, 52, 15, 62
DATA 14, 64, 15, 74