public void Update()
        {
            oldKeyboard = keyboard;
            keyboard = Keyboard.GetState();
            if (WasKeyJustPressed(Keys.Space))
            {
                pauseMouse = !pauseMouse;
            }
            else if (IsKeyDown(Keys.Space) && pauseMouse && (WasMouseLeftJustPressed() || WasMouseRightJustPressed()))
            {
                // force an update if the user clicks
                mouse = Mouse.GetState();
            }

            if (pauseMouse)
            {
                mouse = oldMouse;
            }
            else
            {
                oldMouse = mouse;
                mouse = Mouse.GetState();
            }

            if (mouseLeft != null)
            {
                mouseLeft.Update(mouse);
                mouseMiddle.Update(mouse);
                mouseRight.Update(mouse);
            }
            else
            {
                mouseLeft = new MouseButtonState(MouseButton.LEFT, mouse);
                mouseMiddle = new MouseButtonState(MouseButton.MIDDLE, mouse);
                mouseRight = new MouseButtonState(MouseButton.RIGHT, mouse);
            }
        }
Example #2
0
 public MouseButtonEventArgs(Mouse mouse, MouseButtonState buttonState, MouseButton changedButton)
     : base(mouse)
 {
     ButtonState = buttonState;
     ChangedButton = changedButton;
 }