private void SetPosition(Vector pos) { #if !WINRT && !WINDOWS_PHONE // Not supported on WinRT... only sets xna coords Vector screenpos = pos.Transform(screen.GetScreenInverse()); XnaV2 center = ScreenView.ToXnaCoords(screenpos, screen.ViewportSize, Vector.Zero); XnaMouse.SetPosition((int)center.X, (int)center.Y); #endif }
internal override MouseState GetState() { #if WINDOWS_PHONE || ANDROID return(new MouseState()); #elif WINRT return(XnaMouse.GetState()); #else if (!IsCursorVisible) { // Reset the mouse to the center of the screen SetPosition(Vector.Zero); } return(XnaMouse.GetState()); #endif }
/// <summary> /// Initializes a new instance of the <see cref="XnaInputDevices"/> class. /// </summary> public XnaInputDevices() { mKeyboard = new XnaKeyboard(); mMouse = new XnaMouse(); }
/// <summary> /// Sets the position of the mouse /// </summary> /// <param name="position">The new position of the mouse</param> public static void SetPosition(Vector2 position) { XnaMouse.SetPosition((int)position.X, (int)position.Y); }
internal Mouse(ScreenView screen) { this.screen = screen; this.CurrentState = XnaMouse.GetState(); }