puklaus's picture

Mouse deltas

I use this piece of code to rotate my camera when pressing mouse left button:

            if (Mouse[MouseButton.Left])
            {
                cam.TurnXZ(Mouse.XDelta);
                cam.LookUpXZ(Mouse.YDelta);
            }
            int tmp = Mouse.XDelta; tmp = Mouse.YDelta;  // hack: update deltas

now *Deltas are obsolete, so how i should get deltas?

Like this?

int _oldX, _oldY;
.
.
            if (Mouse[MouseButton.Left])
            {
                cam.TurnXZ(Mouse.X-_oldX);
                cam.LookUpXZ(Mouse.Y-_oldY);
            }
            _oldX=Mouse.X; _oldY=Mouse.Y;

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Either this or hook the Mouse.Move event.