Qbasicnews.com
April 09, 2020, 08:04:06 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: mouse  (Read 2841 times)
andy
Senior Member
**
Posts: 175



WWW
« on: March 01, 2004, 08:38:16 AM »

I have a program to use the mouse in qb, but Ican't remember how to change the mouse pointer: In screen 13 the mouse is way to big I want a kind of cross hairs thing.

Also I can only use the call absolute command when I open QB first and then open the file as I need the /L tag on the command Is there any way to make it possible to open the file from your hard drive.

I know all of this sounds kind of confusing but I hope you understand.
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #1 on: March 01, 2004, 09:33:31 AM »

Quote from: "andy"
I have a program to use the mouse in qb, but Ican't remember how to change the mouse pointer: In screen 13 the mouse is way to big I want a kind of cross hairs thing.


I would create a sprite and move it with the mouse coordinates.

Quote
Also I can only use the call absolute command when I open QB first and then open the file as I need the /L tag on the command Is there any way to make it possible to open the file from your hard drive.


DOS prompt: QB /L
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Plasma
Na_th_an
*****
Posts: 1770


WWW
« Reply #2 on: March 01, 2004, 04:36:55 PM »

You can redefine the mouse cursor shape with interrupt 33h:

Code:
DEFINT A-Z
'$INCLUDE: 'QB.BI'

'Screen mask
DATA 1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1
DATA 1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1
DATA 1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1
DATA 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1
D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te1 = 0
    FOR x = 0 TO 7
      READ Bit
      IF Bit THEN Byte1 = Byte1 + 2 ^ (7 - x)
    NEXT
    Byte2 = 0
    FOR x = 0 TO 7
      READ Bit
      IF Bit THEN Byte2 = Byte2 + 2 ^ (7 - x)
    NEXT
    Cursor$ = Cursor$ + CHR$(Byte2) + CHR$(Byte1)
  NEXT
NEXT


DIM Regs AS RegTypeX
Regs.ax = 0
CALL INTERRUPTX(&H33, Regs, Regs)

Regs.ax = 9
Regs.bx = 5 'Hot spot, horizontal
Regs.cx = 5 'Hot spot, vertical
Regs.es = VARSEG(Cursor$)
Regs.dx = SADD(Cursor$)
CALL INTERRUPTX(&H33, Regs, Regs)

Regs.ax = 1
CALL INTERRUPTX(&H33, Regs, Regs)

k$ = INPUT$(1)
Logged
R@dioman
Ancient QBer
****
Posts: 410



« Reply #3 on: March 02, 2004, 04:19:26 AM »

Yeah, I agree with Nathan. I would use a sprite. It's way simpler. Check out T.A.N.K to see my mouse cursor. It nicely animated. The link is at the bottom of my post.
Logged

andy
Senior Member
**
Posts: 175



WWW
« Reply #4 on: March 02, 2004, 06:36:51 AM »

cheers, yeah I will use a sprite.

Any ideas about the other prob
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #5 on: March 02, 2004, 09:04:42 AM »

I told you: run QB /L in the DOS prompt.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
andy
Senior Member
**
Posts: 175



WWW
« Reply #6 on: March 02, 2004, 10:26:08 AM »

sorry, I missed that, but thats not the problem

the problem is that I can't doulble click and open a .bas file directly if it uses the mouse. I can open qb and do it that way but that takes ages.
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
Plasma
Na_th_an
*****
Posts: 1770


WWW
« Reply #7 on: March 02, 2004, 10:44:32 AM »

Open up Windows Explorer, click Tools -> Folder Options -> File Types, scroll down to BAS, click on it, click Advanced, click Edit, and change "Application used to perform action" to:

C:\QB45\QB.EXE %1 /L

(where C:\QB45 is the path to QB)
Logged
andy
Senior Member
**
Posts: 175



WWW
« Reply #8 on: March 05, 2004, 05:35:48 AM »

Thanks thats usefull.

Ok how can you move the mouse using qb, as if it was an example thing but the mouse posistion actually moves?
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
R@dioman
Ancient QBer
****
Posts: 410



« Reply #9 on: March 05, 2004, 05:55:49 AM »

You have to communicate with interrupt &H33. If you don't know how to use Interrupts, there's some tutorials out there. Setting your AX register to different values will yield different functions for the mouse. Here they are:

InReg.AX = 0
Init Mouse

InReg.AX = 1
Show Mouse

InReg.AX = 2
Hide Mouse

InRegs.AX =3
Button Status(using OutReg.BX)
(if OutReg.BX = 0 then none
if OutReg.BX = 1 then Left Button
if OutReg.BX = 2 then Right button
if OutReg.BX = 3 then Left and Right
if OutReg.BX = 4 then Middle button
if OutReg.BX = 5 then Left and Middle
if OutReg.BX = 6 then Middle and Right
if OutReg.BX = 7 then all three)

InRegs.AX = 3
Mouse Coordinates(Using Outregs CX and DX)
OutRegs.CX = X
OutRegs.DX = Y
Note!: For screen 13, X = OutRegs.CX \ 2
For screen 0, X = OutRegs.CX \ 8, Y = OutRegs.DX \ 8

There's some other ones for limiting an area the mouse can move on and more, but I forget them.

So to move the mouse, get the X and Y values by sending 3 in the AX register to Interrupt &H33 then reading the CX and DX registers and draw your mouse sprite at that location.Make sure to do those calculations above if using screen 0 or 13.
Logged

Frobozz
Forum Regular
**
Posts: 145



WWW
« Reply #10 on: March 05, 2004, 06:10:55 PM »

You may want to consider downloading a complete list of the interrupts from here:  http://www-2.cs.cmu.edu/~ralf/files.html

There is also an online version made in HTML:  http://www.ctyme.com/rbrown.htm
Logged
andy
Senior Member
**
Posts: 175



WWW
« Reply #11 on: March 06, 2004, 11:30:44 AM »

Ok, is there any way the to check if the mouse is being moved while keeping the pointer in the center, like on some of the 3d shooting games (MAX Payne 2, delta force etc...)
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
Z!re
*/-\*
*****
Posts: 4599


« Reply #12 on: March 06, 2004, 12:14:30 PM »

Code:

If Mouse.X <> Center.X Then
 EntireMap.X=EntireMap.X+(Center.X-Mouse.X)
 SetMouse.X=Center.X   'reset mouse location
End If
If Mouse.Y <> Center.Y Then
 EntireMap.Y=EntireMap.Y+(Center.Y-Mouse.Y)   'to invert the axis just change the '+(Center.Y-Mouse.Y)' to '-(Center.Y-Mouse.Y)'
 SetMouse.Y=Center.Y   'reset mouse location
End If

DrawEntireMap 'err, the visible parts that is

DrawMouse/Crosshair   'it will always be Center.X, Center.Y
Logged
andy
Senior Member
**
Posts: 175



WWW
« Reply #13 on: March 07, 2004, 07:06:04 AM »

Quote
SetMouse.X=Center.X


Is this using the interperets radioman provided?
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
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!