Ejemplo n.º 1
0
        public void Update(GameEngine engine)
        {
            //Console.WriteLine(DeltaScrollWheel);
            //DeltaScrollWheel = 0; //we only want the difference for each frame, the total value is irrelevant

            PreviousKeyboardState.Clear();
            PreviousMouseState.Clear();
            PreviousMousePosition = MousePosition;

            MousePosition = Mouse.GetPosition(engine.Window);
            foreach (KeyValuePair <Keyboard.Key, bool> valuePair in KeyboardState)
            {
                PreviousKeyboardState.Add(valuePair.Key, valuePair.Value);
            }
            foreach (KeyValuePair <Mouse.Button, bool> valuePair in MouseState)
            {
                PreviousMouseState.Add(valuePair.Key, valuePair.Value);
            }

            KeyboardState.Clear();
            MouseState.Clear();
            foreach (Keyboard.Key key in keysEnum)
            {
                KeyboardState.Add(key, CheckKey(key));
            }
            foreach (Mouse.Button button in buttonsEnum)
            {
                MouseState.Add(button, CheckButton(button));
            }
        }
Ejemplo n.º 2
0
 public static bool IsButtonPreviouslyDown(MouseButton b)
 {
     return(PreviousMouseState.GetState(b) == ButtonState.Released);
 }
Ejemplo n.º 3
0
 public static bool IsButtonPreviouslyUp(MouseButton b)
 {
     return(PreviousMouseState.GetState(b) == ButtonState.Pressed);
 }
Ejemplo n.º 4
0
 public static ButtonState GetPreviousButtonState(MouseButton b)
 {
     return(PreviousMouseState.GetState(b));
 }