Hi, I'm using D3DXSprite and I've got the mosue working and running. I'm using C++, but on a VB site I saw some code on how to process the position of the mouse. Here is the small code that I have for this.
x=x+mouseState.lX*MOUSE_SPEED;
y=y+mouseState.lY*MOUSE_SPEED;
if(x<0)
{
x=0;
}
if(x>800)
{
x=800;
}
if(y<0)
{
y=0;
}
if(y>600)
{
y=600;
}
I am writing to a file the position of the mouse when I click a button. I ran the program 3 different times, putting the data into 3 different files, everytime the x and y positions were off. Here was the data that I received.
quote:
File 1:
Button 1 was pressed where x=266 and y=140
File 2:
Button 1 was pressed where x=222 and y=168
File 3:
Button 1 was pressed where x=240 and y=182
These are so far off but I know I click the exact spot or maybe one pixel off. What is the bug in my code that is doing this? I can't have this, I need it to be the same everytime, otherwise buttons and such won't work.
Any help would be greatly appreciated. Thanks!
Edited by - Badone on December 29, 2001 9:34:07 PM