Ejemplo n.º 1
0
        /// <summary>
        /// Checks if the requested mosue button is an old press.
        /// </summary>
        /// <param name="button">
        /// The mouse button to check.
        /// </param>
        /// <returns>
        /// A bool indicating whether the selected mouse button is not being
        /// pressed in the current state and is being pressed in the old state.
        /// </returns>
        public bool IsMouseButtonRelease(CCMouseButtons button)
        {
            switch (button)
            {
            case CCMouseButtons.LeftButton:
                return(
                    LastMouseState.LeftButton == ButtonState.Pressed &&
                    CurrentMouseState.LeftButton == ButtonState.Released);

            case CCMouseButtons.MiddleButton:
                return(
                    LastMouseState.MiddleButton == ButtonState.Pressed &&
                    CurrentMouseState.MiddleButton == ButtonState.Released);

            case CCMouseButtons.RightButton:
                return(
                    LastMouseState.RightButton == ButtonState.Pressed &&
                    CurrentMouseState.RightButton == ButtonState.Released);

            case CCMouseButtons.ExtraButton1:
                return(
                    LastMouseState.XButton1 == ButtonState.Pressed &&
                    CurrentMouseState.XButton1 == ButtonState.Released);

            case CCMouseButtons.ExtraButton2:
                return(
                    LastMouseState.XButton2 == ButtonState.Pressed &&
                    CurrentMouseState.XButton2 == ButtonState.Released);

            default:
                return(false);
            }
        }
Ejemplo n.º 2
0
 public bool IsMouseButtonUp(CCMouseButtons button)
 {
     switch (button)
     {
         case CCMouseButtons.LeftButton:
             return CurrentMouseState.LeftButton == ButtonState.Released;
         case CCMouseButtons.RightButton:
             return CurrentMouseState.RightButton == ButtonState.Released;
         case CCMouseButtons.MiddleButton:
             return CurrentMouseState.MiddleButton == ButtonState.Released;
         case CCMouseButtons.ExtraButton1:
             return CurrentMouseState.XButton1 == ButtonState.Released;
         case CCMouseButtons.ExtraButton2:
             return CurrentMouseState.XButton2 == ButtonState.Released;
         default:
             return false;
     }
 }