PDA

View Full Version : Mouse + Animation Trouble



destroyerBEACON
05-01-2002, 09:01 AM
I am trying to program a mouse into my program. My mouse function stores all of the pixels under the cursor into a matrix called umouse. It then draws the cursor. Whenever the mouse moves, the mouse is erased using the umouse data, then umouse stores the new data while the cursor is being drawn.

Only one problem...
Whenever some other object moves over the mouse, i.e. a moving colored tile moves over the cursor, when the cursor moves, it deletes part of the other object (colored tile) and replaces it with the umouse data.

How can I make a decent mouse function that doesn't change any other part of the screen?

I am using Turbo C++ 1.00

destroyerBEACON
05-01-2002, 09:06 AM
Attached is the code that I used.

muttski
05-02-2002, 01:16 PM
First you must realize most people dont care about your other code, if you could clean it up a bit and just have the mouse code Im sure people would help out more. Are you making an editor for a tile rpg or something?

Sunny
05-03-2002, 09:26 PM
It would be nice if you told us a little bit more information. Like, what kind of compiler are you using, what video mode.
Oyherwise, you could try (if you are using a borland) downloading the svgacc lib file from :
http://www.zephyrsoftware.com
and adding it to your project for compilation.

tell us more


Stef:D

Vicious
05-09-2002, 11:04 PM
does that show how to capture mouse clicks??

Is it hard to do that?

VirtualAce
05-11-2002, 07:39 PM
The original mouse handler use XOR and AND to do this.

However, if you use a double buffer you can do this as well.




To trap mouse clicks use subfuntion 03h.


void GetMousePosition(void)
{
union REGS regs;
regs.x.ax=0x03;
int86(0x33,& regs, & regs);

int ButtonDown=regs.x.bx;
int XPos=regs.x.cx;
int YPos=regs.x.dx;
}


For graphic mode resolutions below 640 you must divide CX by 2 to get the correct result. int XPos=regs.x.cx>>1;

Vicious
05-12-2002, 10:25 PM
:confused:

Xmevs
05-16-2002, 06:53 AM
is GetMousePosition() a function from the svgacc-lib-thingy that was mentioned, or is it elsewhere?

VirtualAce
05-17-2002, 06:54 AM
No, I just coded that for my post.