Пример #1
0
        internal static void Update()
        {
            OldKeyboard = Keyboard;
            OldMouse = Mouse;

            Keyboard = KeyHandler.GetState();
            Mouse = MouseHandler.GetState();
        }
Пример #2
0
        /// <summary>
        /// Retrieves the current mouse state
        /// </summary>
        /// <returns>The current mouse state</returns>
        public static MouseHandler GetState()
        {
            MouseState xm = Mouse.GetState();

            MouseHandler ret = new MouseHandler()
            {
                Left = xm.LeftButton == ButtonState.Pressed,
                Right = xm.RightButton == ButtonState.Pressed,
                Middle = xm.MiddleButton == ButtonState.Pressed,
                XButton1 = xm.XButton1 == ButtonState.Pressed,
                XButton2 = xm.XButton2 == ButtonState.Pressed
            };

            ret.pos = xm.Position();

            oldSW = currentSW;

            currentSW = xm.ScrollWheelValue;

            ret.ScrollWheel = currentSW - oldSW;

            return ret;
        }