www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/25/01:25:29

From: Leif <LeifDude AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: (new guy) mouse woes
Date: Sat, 24 Oct 1998 22:43:35 -0700
Organization: NorthWest Nexus Inc.
Lines: 34
Message-ID: <3632BA87.655D@hotmail.com>
References: <70ivmg$fak$1 AT nnrp1 DOT dejanews DOT com>
NNTP-Posting-Host: blv-pm103-ip27.halcyon.com
Mime-Version: 1.0
X-Mailer: Mozilla 3.04 (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

jsc AT lds DOT co DOT uk wrote:
> 
> Hello all,
> I'm new here (mainly because my news program recently committed suicide).
> I'm having a few probs with using a mouse in djgpp. I have a function
> 
> void mouse_abs_pos(int *x, int *y)
> {
>         union REGS regs;
>         regs.x.ax = 0x03;
>         int86(0x33, &regs, &regs);
>         *x = regs.x.cx;
>         *y = regs.x.dx;
>         return 0;
> }
> 

Like someone else posted...  call yer function like this... 

mouse_abs_pos(&MouseX, &MouseY);

BUT!!! Inside of that function you should use the  .w members instead of
the .x ones.
EXAMPLE: 

*x = regs.w.cx;
  instead of
*x = regs.x.cx;

Using the .w members makes SURE the cx is treated as 16bit. The .x can
be either 16 or 32bit which will give you screwy x and y values if it
happens to be 32 bit. 
I ran into that problem when I was trying to get my mouse stuff working.
Hope it helps...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019