• Advertisement

Archived

This topic is now archived and is closed to further replies.

Unexpected mouse coords buffered DI

This topic is 5158 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have some code for direct input in immediate mode and when the mouse coords are reported back they are, say (-3, -5) then they snap back to (0, 0) when the mouse is left untouched, this is what I expected. Now when I use buffered direct input, the movement of the mouse seems to come back the same, ex -3, -5, but when at rest, they snap back to odd numbers, like (1, -1), (-1, -1), (2, 1) etc, usually in the range -2 to no more then 4 for both x and y. Any idea if this is the right behaviour? From what I can tell its in relative mode by default, but if I SetProerty(DIPROP_AXISMODE, ...) to DIPROPAXISMODE_ABS i get back large numbers. Now, if in absolute mode, i do something like this
case DIMOFS_X:
{
static LONG lastMoveX = 0;
LONG currMoveX = m_DIDeviceObjectData[i].dwData;            
m_axis[0] = currMoveX - lastMoveX;
lastMoveX = currMoveX;
} break;
Ive basically changed it back to relative mode myself but
m_axis[0] = currMoveX - lastMoveX;
still ends up coming out in the range -2 to 4?? why is it that the movement never comes back to 0, 0 in relative mode buffered input, like immediate mode does??

Share this post


Link to post
Share on other sites
Advertisement
Buffered input only returns information if the mouse has changed. If there is no change in the mouse, nothing is added into the buffered queue. Think of it in the way of the keyboard. With buffered keyboard input, if you press a key, only 1 message is put into the buffered keyboard queue, key_down... Nothing else is going to be put into the buffered keyboard queue until the key is let up, or another key is pressed. When nothing is changing with the device, the queue remains empty. Apply the same principle to the mouse.

Share this post


Link to post
Share on other sites

  • Advertisement