Relative mouse pos

Mouse.GetState();

Returns absolute position, for x, y and mouse wheel. That is cool

But also it should return relative position like DX and DY and DWheel.

Like DirectInput does.



Answer this question

Relative mouse pos

  • ShyamD

    Why only absolute value

    Then I have to calculate the relative position myself (relativePosition = oldPosition + newPosition). If the mouse cursor already is at X=0, then my game code won't respond to the mouse when dragging it to the left. (relativePosition = 0 + 0) = (relativePosition = 0).

    How do you want us to solve this I think this one needs to fixed if you want us to create games that uses the mouse for input!

  • jptrt

    Why Mr. Walker

    Thanks for the improvements for the moue input but why the mouse value is still absolute

    Why you guys don't use direct input for mouse

    Yes, I know XNA is cross platform but XBOX does not have mouse any way. So mouse input implementation can be platform specific.


  • Novelle

    ...or they could just add relative mouse position, seems a lot easier to me!

  • kawing0510

    Kobingo wrote:

    Then I have to calculate the relative position myself (relativePosition = oldPosition + newPosition). If the mouse cursor already is at X=0, then my game code won't respond to the mouse when dragging it to the left. (relativePosition = 0 + 0) = (relativePosition = 0).


    You can get the relative mouse movement by reading the mouse position as an offset from the centre of the game window and then setting the mouse position to the centre of the game window. There were problems doing this in beta 1 but it seems likely that they have been fixed in beta 2.

    Cheers,
    Leaf.


  • Scorchio

    We've made several improvements to Mouse since Beta 1, but the value it returns are still absolute.

  • Relative mouse pos