Qbasicnews.com
August 09, 2020, 08:08:21 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: The InFamous Mouse  (Read 1823 times)
Oz
I hold this place together
*****
Posts: 923



« on: February 24, 2004, 05:29:26 PM »

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
Logged
Plasma
Na_th_an
*****
Posts: 1770


WWW
« Reply #1 on: February 24, 2004, 06:31:46 PM »

I have never seen a mouse routine written for QB that didn't work with QB 4.5...
Logged
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #2 on: February 24, 2004, 07:32:52 PM »

... and by use of CALL ABSOLUTE you're using a library... the default qb.lib library Wink
Logged

Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #3 on: February 24, 2004, 08:03:03 PM »

:shifty:
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.
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Oz
I hold this place together
*****
Posts: 923



« Reply #4 on: February 24, 2004, 09:28:50 PM »

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
Logged
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #5 on: February 24, 2004, 09:41:18 PM »

Download the full version of qb 4.5 instead. Get it from qbnz.com/pages/downloads/software
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!