SadConsole.Input.MouseInfo.ProcessMouse C# (CSharp) Method

ProcessMouse() public method

Fills out the state of the mouse.
public ProcessMouse ( GameTime gameTime ) : void
gameTime GameTime
return void
        public void ProcessMouse(GameTime gameTime)
        {
            MouseState currentState = Mouse.GetState();

            bool leftDown = currentState.LeftButton == ButtonState.Pressed;
            bool rightDown = currentState.RightButton == ButtonState.Pressed;

            ScrollWheelValueChange = ScrollWheelValue - currentState.ScrollWheelValue;
            ScrollWheelValue = currentState.ScrollWheelValue;

            ScreenLocation = new Point((int)(currentState.X * Engine.RenderScale.X), (int)(currentState.Y * Engine.RenderScale.Y)) - new Point((int)(Engine.RenderRect.X * Engine.RenderScale.X), (int)(Engine.RenderRect.Y * Engine.RenderScale.Y));
            bool newLeftClicked = LeftButtonDown && !leftDown;
            bool newRightClicked = RightButtonDown && !rightDown;

            if (!newLeftClicked)
                LeftDoubleClicked = false;
            if (!newRightClicked)
                RightDoubleClicked = false;

            if (LeftClicked && newLeftClicked && gameTime.ElapsedGameTime.TotalMilliseconds < 1000)
                LeftDoubleClicked = true;
            if (RightClicked && newRightClicked && gameTime.ElapsedGameTime.TotalMilliseconds < 1000)
                RightDoubleClicked = true;

            LeftClicked = newLeftClicked;
            RightClicked = newRightClicked;
            _leftLastClickedTime = gameTime.ElapsedGameTime;
            _rightLastClickedTime = gameTime.ElapsedGameTime;
            LeftButtonDown = leftDown;
            RightButtonDown = rightDown;
        }