コード例 #1
0
        /// <summary>
        /// Updates the mouse states.
        /// </summary>
        /// <param name="gameTime">Not used.</param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            var position = platform.GetLocation();

            nextState.x = position.X;
            nextState.y = position.Y;

            if (!isFirstUpdateDone)
            {
                state = nextState;
            }

            var previousState = state;

            state        = nextState;
            state.deltaX = state.X - previousState.X;
            state.deltaY = state.Y - previousState.Y;

            nextState.wheelDelta = 0;
            nextState.leftButton.ResetEvents();
            nextState.middleButton.ResetEvents();
            nextState.rightButton.ResetEvents();
            nextState.xButton1.ResetEvents();
            nextState.xButton2.ResetEvents();
            isFirstUpdateDone = true;
        }
コード例 #2
0
        /// <summary>
        /// Gets current mouse state.
        /// </summary>
        /// <returns>A snapshot of current mouse state</returns>
        /// <exception cref="NullReferenceException">Is thrown if <see cref="Initialize"/> is not called.</exception>
        public MouseState GetState()
        {
            // read the mouse position information
            var position = platform.GetLocation();

            return(new MouseState(left, middle, right, xButton1, xButton2, position.X, position.Y, wheelDelta));
        }
コード例 #3
0
ファイル: MouseManager.cs プロジェクト: neojijon/SharpDX
        /// <summary>
        /// Gets current mouse state.
        /// </summary>
        /// <returns>A snapshot of current mouse state</returns>
        /// <exception cref="NullReferenceException">Is thrown if <see cref="Initialize"/> is not called.</exception>
        public MouseState GetState()
        {
            // read the mouse position information
            var position = platform.GetLocation();

            state.x = position.X;
            state.y = position.Y;
            return(state);
        }