home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR3
/
MSPROG.ZIP
/
MSDEMO.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-11-26
|
2KB
|
82 lines
'Mouse Coordinate Display Demo
'By: Brad Wilson
'11/26/1993
'This program requres that the UITBxxx.QLB or similar quick library be
'loaded. This program was written using UITBEFR.QLB.
'Note: Most of this program is just graphics stuff (I get a little carried
' away now and then). The main part of the program is in lines 52 to 54.
'Required Include Files (these are from PDS's User Interface Toolbox)
'$INCLUDE: 'general.bi'
'$INCLUDE: 'mouse.bi'
DECLARE SUB getmouse (lb%, rb%, x%, y%) 'lb% - left button
'rb% - right button
'x%,y% - x and y coordinates
SCREEN 12: CLS
'Set up some semi-spiffy graphics
FOR i% = 0 TO 14
PALETTE i%, 65536 * INT(i% * 4.5)
NEXT i%
PALETTE 15, 63
c = 0: cflag = .6
FOR i% = 0 TO 625
LINE (i%, 0)-(i%, 479), c
c = c + cflag
IF c <= 0 OR c >= 14 THEN cflag = -cflag
IF c < 0 THEN
c = 0
ELSEIF c > 14 THEN
c = 14
END IF
NEXT i%
'Turn on Mouse and show coordinates at upper-left
'until user presses a key.
LINE (0, 0)-(152, 32), 14, B 'Create a "Window" for
LOCATE 1, 1: PRINT SPACE$(19) 'coordinate display.
LOCATE 2, 1: PRINT SPACE$(19)
MouseShow 'Defined in mouse.bi, included in UITBxxx.QLB
c = 63: cflag = 1 'Used for color fading
DO
k$ = INKEY$
getmouse lb%, rb%, x%, y% 'Here's the heart of
LOCATE 1, 1: PRINT "x ->"; x%; " y ->"; y% 'the program.
LOCATE 2, 1: PRINT "lb->"; lb%; " rb->"; rb% 'Teeny, eh?
PALETTE 15, 65536 * (63 - c) + c
c = c + cflag
IF c <= 0 OR c >= 63 THEN cflag = -cflag
IF c < 0 THEN
c = 0
ELSEIF c > 63 THEN
c = 63
END IF
LOOP UNTIL LEN(k$) 'Loop until keypress
MouseHide 'Defined in mouse.bi, included in UITBxxx.QLB
SCREEN 0: WIDTH 80: CLS
END
SUB getmouse (lb%, rb%, x%, y%)
m1% = 3 'Call Function 3:
MouseDriver m1%, m2%, m3%, m4% '
x% = m3%
y% = m4%
IF m2% AND 1 THEN lb% = -1 ELSE lb% = 0
IF m2% AND 2 THEN rb% = -1 ELSE rb% = 0
END SUB