Mouse.SetPosition Method
Note
This method is available only when developing for Windows.
Sets the position of the mouse cursor relative to the upper-left corner of the window.
Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public static void SetPosition (
int x,
int y
)
Parameters
- x
The horizontal position of the mouse cursor, relative to the left edge of the game window. - y
The vertical position of the mouse cursor, relative to the upper edge of the game window.
Remarks
When using this method to take relative input, such as in a first-person game, set the position of the mouse to the center of your game window each frame. This will allow you to read mouse movement on both axes with the greatest amount of granularity.
See Also
Reference
Mouse Class
Mouse Members
Microsoft.Xna.Framework.Input Namespace
Platforms
Windows XP SP2, Windows Vista