PDA

View Full Version : mouse programming



saurabh
10-08-2001, 01:19 PM
hi ,can anyone tell me how to change the color of the mouse pointer while working with graphics in c.i think it will require the use of interrupts

DavidP
10-08-2001, 06:44 PM
www.brackeen.com

Go to the VGA tutorial on the site. It has some mouse stuff.

doubleanti
10-09-2001, 05:08 PM
when i do my mousing, i don't use the hw cursor, instead, i just use my own since using most hw cursors [tied to an interrupt] don't allow you to do tricks like animation and they are limited to particular video modes... so, i recommend you do use interrupts for your other mousing variables, [int 33h...] and use your own cursor setup...

VirtualAce
10-09-2001, 07:28 PM
Excellent doubleanti. He is right. For mouse cursors you should use your own graphics. The hardware cursor is fine for applications, but usually not for games or other types of programming.

There is not a function in the standard MS/Logitech mouse driver for changing the color of the mouse pointer. However, some drivers provide more (sometimes less) support for various functions. But the standard functions 00h through 09h do not handle mouse cursor color.

Just use sub-function 03h to retrieve the coords of the mouse and place your own graphic at those coords. If double-buffering just 'put' your mouse graphic in the buffer at those coords. This is done after all other operations (drawing, rendering, etc) are complete. When you copy the buffer to vidmem the mouse cursor will be on top of all of the graphics. If you are not double-buffering, use bit masks to define your mouse cursor.
I think the order of logical ops is:

AND the mouse cursor mask with the screen image
XOR the mouse cursor data with the screen image




union REGS regs;
regs.x.ax=0x03;
int86(0x33,regs,regs)
int mousex=regs.cx; //regs.cx>>1 for 320 width
int mousey=regs.dx;
//call your function to put the image at mousex,mousey


You must have ampersands before the regs in the call to int86().
For some reason, this board messes up the ampersands which prevents me from using them correctly.

If you want to change your hardware mouse cursor, use sub-function 09h and the appropriate bit masks. Logical operations are taken care of by the interrupt handler.

master5001
10-10-2001, 01:15 PM
Hmmm no ampersands? I didn't know that...There is probably a way.

&



&




&


lets see if any of those work.