Mouse.SetPosition Method
Sets the position of the mouse cursor relative to the upper-left corner of the window.
Syntax
'Declaration
Public Shared Sub SetPosition ( _
x As Integer, _
y As Integer _
)
public static void SetPosition (
int x,
int y
)
public:
static void SetPosition(
int x,
int y
)
Parameters
- x
Type: Int32
The horizontal position of the mouse cursor, relative to the left edge of the game window. - y
Type: Int32
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.
Requirements
Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Reference
Mouse Class
Mouse Members
Microsoft.Xna.Framework.Input Namespace
Platforms
Windows Phone