Mouse Reference

To assign the mouse values to a control, use these as InputMethod objects for the AssignControl method:
InputManager.Mouse.X;
InputManager.Mouse.Y;
InputManager.Mouse.ScrollWheelValue;

X, Y, and ScrollWheelValue return the absolute position of the mouse pointer and scroll wheel, so if you want their value relative to last frame's, use:
InputManager.Mouse.RelativeX;
InputManager.Mouse.RelativeY;
InputManager.Mouse.RelativeScrollWheelValue;

These methods provided by MouseHelper return InputMethods that can be assigned to a control:
InputManager.Mouse.Click(MouseHelper.Button);
InputManager.Mouse.Release(MouseHelper.Button);
InputManager.Mouse.Up(MouseHelper.Button);
InputManager.Mouse.Down(MouseHelper.Button);

Where MouseHelper.Button is one of the following:
MouseHelper.Buttons.Left;
MouseHelper.Buttons.Right;
MouseHelper.Buttons.Middle;
MouseHelper.Buttons.XButton1;
MouseHelper.Buttons.XButton2;

You can also access the mouse state directly via:
InputManager.Mouse.State;
InputManager.Mouse.PreviousState;

Finally, to make a string for use in one of the string based control generators, use "Mouse" followed by "X" or "Y" if you want the position, or one of the possible actions (Up, Down, JustPressed, JustReleased) followed by the button name. All of the terms are to be joined via dots.

Examples:
Mouse.X
Mouse.Down.Right

If you want to see all of the possibilities, look in the source code.

Last edited Mar 23, 2009 at 4:10 AM by Shader, version 2

Comments

No comments yet.