Sign in to follow this  
Delryn

MDX: DirectInput: Convertign absolute Coordinates

Recommended Posts

Delryn    142
Could somebody explain me how to convert absolute mouse coordinates to screen coordinates? Here is my Code:
     public Mouse()
        {
            device = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Mouse);
            device.Properties.AxisModeAbsolute = true;
            device.Acquire();

            pos = new Point();
            pos.posX = 512;  // For testing
            pos.posY = 368;
        }

      override public void Poll()
        {
            MouseState state = device.CurrentMouseState;
            pos.posX += state.X;
            pos.posY += state.Y;
            mouseButtons = state.GetMouseButtons();
        }
But in pos.posX and posY are always values like 4852852 -34828358 2358283 8562836 5813851 3858235 2358888 -6353455 and so on. How can I get "the real" position? Thanks :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this