PDA

View Full Version : Mouse


zoviac
10-01-2002, 09:37 AM
i got another question..

so, anyone got links for mouse tutorials?

Kamikaze!
10-01-2002, 05:52 PM
http://www.brackeen.com/home/vga/mouse.html

you have to change the code slightly to make it work in DJGPP though, such as union regs becomes __dpmi_regs and int86 becomes __dpmi_int but it shouldn't be too hard.

One tip: Make a global struct that holds all the mouse data, such as how many buttons and if a button is pressed and update it with a function in a loop (= your main loop).

Edit: Change the mouse boundaries with this (can't find the link where I got it from anymore):
void mouse_setbounds(short xmin, short xmax, short ymin, short ymax)
{
__dpmi_regs regs;

// Set X boundaries
regs.x.ax = 7;
regs.x.cx = xmin; // minimum x
regs.x.dx = xmax; // maximum x
__dpmi_int(0x33,& regs); // call the interrupt

// Set Y boundaries
regs.x.ax = 8;
regs.x.cx = ymin; // minimum y
regs.x.dx = ymax; // maximum y
__dpmi_int(0x33,& regs); // call the interrupt
}

zoviac
10-07-2002, 01:59 PM
aight, i succeeded to do show a mouse cursor in tc, ima try the link now.. thx