Mouse cursor
Posted: Tue Aug 25, 2009 7:49 am
How to set a different mouse cursor?
Discuss QBasic, Freebasic, QB64 and more
http://petesqbsite.com/phpBB3/
Code: Select all
SCREEN 9
DIM SHARED back
_MOUSEHIDE
LINE (0,0)-(640,350),2,BF
LINE (0,350)-(640,40),6,BF
LINE (0,0)-(640,350),3
GET (0,0)-(639,349),back
DO
DO
LOOP UNTIL _MOUSEINPUT
CALL redraw
cur=_LOADIMAGE("cursor.png") ' 16 * 16 cursor
_PUTIMAGE(__MOUSEX,_MOUSEY),cur
LOOP
SUB redraw
PUT (0,0),back,PSET
END SUB
Code: Select all
X = __MOUSEX: Y = _MOUSEY
GET (X, Y)-(X + 15, Y + 15), BG 'get first BG area
PUT (X, Y), Cursor, PSET
PX = X: PY = Y
DO
X = __MOUSEX: Y = _MOUSEY
IF X <> PX OR Y <> PY THEN 'look for a changed coordinate value
PUT (PX, PY), BG, PSET 'replace previous BG first
GET (X, Y)-(X + 15, Y + 15), BG 'GET BG at new position next
'PUT (X, Y), Mask, AND '2 lines of code if using a mask
'PUT (X, Y), Cursor 'XOR is default with mask
PUT (X, Y), Cursor, PSET 'PUT cursor image at new position
END IF
PX = X: PY = Y 'previous coordinates
LOOP UNTIL INKEY$ = CHR$(27)
Code: Select all
FOR xx = 280 TO 83 + 280
FOR yy = 200 TO 260
IF POINT(xx, yy) = 0 THEN PSET (xx, yy), 15 ELSE PSET (xx, yy), 0
NEXT yy
NEXT xx
GET (280, 200)-(83 + 280, 260), Mask(0)