コード例 #1
0
 /// <summary>
 /// Handles the MouseWheelMoved event of the <see cref="GameBase.RenderWindow"/>.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="SFML.Window.MouseWheelEventArgs"/> instance containing the event data.</param>
 void rw_MouseWheelMoved(object sender, MouseWheelEventArgs e)
 {
     if (MouseWheelMoved != null)
     {
         MouseWheelMoved.Raise(this, e);
     }
 }
コード例 #2
0
        internal override void Update(GameTime gameTime)
        {
            _gameTime     = gameTime;
            _currentState = Mouse.GetState();

            CheckButtonPressed(s => s.LeftButton, MouseButton.Left);
            CheckButtonPressed(s => s.MiddleButton, MouseButton.Middle);
            CheckButtonPressed(s => s.RightButton, MouseButton.Right);
            CheckButtonPressed(s => s.XButton1, MouseButton.XButton1);
            CheckButtonPressed(s => s.XButton2, MouseButton.XButton2);

            CheckButtonReleased(s => s.LeftButton, MouseButton.Left);
            CheckButtonReleased(s => s.MiddleButton, MouseButton.Middle);
            CheckButtonReleased(s => s.RightButton, MouseButton.Right);
            CheckButtonReleased(s => s.XButton1, MouseButton.XButton1);
            CheckButtonReleased(s => s.XButton2, MouseButton.XButton2);

            // Check for any sort of mouse movement.
            if (_previousState.X != _currentState.X || _previousState.Y != _currentState.Y)
            {
                MouseMoved.Raise(this, new MouseEventArgs(gameTime.TotalGameTime, _previousState, _currentState));
            }

            // Handle mouse wheel events.
            if (_previousState.ScrollWheelValue != _currentState.ScrollWheelValue)
            {
                MouseWheelMoved.Raise(this, new MouseEventArgs(gameTime.TotalGameTime, _previousState, _currentState));
            }

            _previousState = _currentState;
        }