Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The InFamous Mouse
#1
I find most ASM mouse routines really don't work w/QB4.5, so here is a great mouse routine with some data:

Code:
Defint a-z

'$include: 'QB.BI'

Type MouseType
  b  as integer
  x  as integer
  y  as integer
end type

Const true = -1, false = 0

Declare sub MouseDriver(ax,bx,cx,dx)
Declare function MouseInit()

screen 0
cls

dim mouse as mousetype

if (mouseinit=false) then
print "unable to detect mouse"
end
end if


do
MouseDriver 3,mouse.b,mouse.x,mouse.y   '3 is code for Get Data
'Mouse.b:
'1=Left Button
'2=Right Button
'3=Middle Button
'4=Left & Right Button
'5=Left & Middle Button
'6=Right & Middle Button
'7=All 3 Buttons

'Write your variable handling

'Wait Graphics-
'Hide Mouse
MouseDriver 2,0,0,0

'Write your graphic handling

'Show Mouse
MouseDriver 1,0,0,0
loop until Mouse.b

end

SUB MouseDriver(ax,bx,cx,dx)

'AX:
'1 = mouse show - MouseDriver 1, 0, 0, 0
'2 = mouse hide - MouseDriver 2, 0, 0, 0
'3 = get data - MouseDriver 3, Buttons, X, Y
'4 = put mouse - MouseDriver 4, 0, x, y
'5 = (i can't remeber)
'6 = (i can't remeber)
'7 = max x  - MouseDriver 7, 0, minx, maxx
'8 = max y  - MouseDriver 8, 0, miny, maxy
'9-22 = (i can't figure out)
'>22 = (these will give you errors, and crash ur computer)

dim RegData(1 to 2) as RegType
'Input Data
RegData(1).AX=ax
RegData(1).BX=bx
RegData(1).CX=cx
RegData(1).DX=dx

'51 is the mouse interrupt number
Call Interrupt(51,RegData(1),RegData(2))

ax=RegData(2).AX
bx=RegData(2).BX
cx=RegData(2).CX
dx=RegData(2).DX


END SUB

Function MouseInit ()
MouseDriver MouseInit,0,0,0
END FUNCTION

So-if ur not using a library, please use these routines (unless u don't have QB4.x or better...contact me [hint, hint])

That is all

Oz
Reply
#2
I have never seen a mouse routine written for QB that didn't work with QB 4.5...
Reply
#3
... and by use of CALL ABSOLUTE you're using a library... the default qb.lib library Wink
Reply
#4
Confusedhifty:
Even coding in PureQB, you're using a library. I mean, the Microsoft programmers made those functions/subs, didn't they? And even coding in straight hex machine code in a hex editor, you're using the Intel/AMD/whatever-processor-you're-using's instruction set.
So basically build your own computer with your own instruction set, then you've got "pure" programming.
ANYWAY. Nice routines.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#5
I know that QB is a library, but i mean a library that has built in, no hassle mouse support

thnx 4 the good routines comment---

Can any1 give me a copy of QB.QLB, QB.BI and QB.LIB....
i downloaded this thing that upgraded them...but they stopped working, and I don't like doing backups, so im screwed with a bad copy.........

Plz e-mail it to me

Oz
Reply
#6
Download the full version of qb 4.5 instead. Get it from qbnz.com/pages/downloads/software
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)