On Mon, Mar 26, 2007 at 11:25:08PM -0000, coffeewithsuds wrote:
> I got this code to enable mouse in c/c++ graphics environment.
You know that it will only work in DOS, and is not easily ported to
other operating systems, eg. Windows or Linux?
> union REGS in,out;
You should probably use these as local variables.
> int callmouse()
> {
> in.x.ax=1;
> int86(51,&in,&out);
> return 1;
> }
You should probably change 51 to 0x33, if only to conform to the
standard use of hexadecimal when interrupts are specified.
> void mouseposi(int &xpos,int &ypos,int &click)
I think your code is entirely C, not C++, except for this. So, I would
change the above to:
void mouseposi(int *xpos,int *ypos,int *click)
then call with
mouseposi(&x,&y,&cl);
> initgraph(&g,&m,"c:\tc\bgi");
This should be
initgraph(&g,&m,"c:\\tc\\bgi");
> My problem is, the mouse pointer appears and moves but it is
> restricted to the upper half of the screen.
> Can anyone tell me why is it so?
> How can I make it move in the whole screen.
There is an INT 0x33 call to adjust the mouse cursor positions and
limits. It's been about 15 years since I last did mouse programming in
DOS, so I don't remember what function call it is, but it will be listed
in "Ralf Brown's Interrupt List". http://www.cs.cmu.edu/~ralf/files.html
Regards
Andrew