Export (0) Print
Expand All

Mouse.SetPosition Method

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)

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.

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.

Xbox 360, Windows XP SP2, Windows Vista, Zune

Community Additions

ADD
Show:
© 2014 Microsoft