Beispiel #1
0
        public void CopyInput(InputState state)
        {
            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                PadState[i] = state.PadState[i];
                KeyState[i] = state.KeyState[i];
            }

            MouseState = state.MouseState;
        }
Beispiel #2
0
 public static bool IsBinaryControlDown(BinaryControls control, PlayerIndex player, InputState state)
 {
     int controlInt = (int)control;
     if (controlInt <= 254)
     {
         return (state.KeyState[(int)player].IsKeyDown((Keys)controlInt));
     }
     else if (controlInt <= 279)
     {
         return (state.PadState[(int)player].IsButtonDown((Buttons)(1 << (controlInt - 255))));
     }
     else if (controlInt <= 290)
     {
         MouseState ms = state.GetMouseState((int)player);
         switch ((MouseButtons)(1 << (controlInt - 286)))
         {
             case MouseButtons.Left:
                 return (ms.LeftButton == ButtonState.Pressed);
             case MouseButtons.Middle:
                 return (ms.MiddleButton == ButtonState.Pressed);
             case MouseButtons.Right:
                 return (ms.RightButton == ButtonState.Pressed);
             case MouseButtons.XButton1:
                 return (ms.XButton1 == ButtonState.Pressed);
             case MouseButtons.XButton2:
                 return (ms.XButton2 == ButtonState.Pressed);
         }
     }
     return false;
 }
Beispiel #3
0
 /// <summary>
 /// Create a new input manager
 /// </summary>
 public InputManager()
 {
     currentState = new InputState();
     lastState = new InputState();
     mouseDragButton = null;
 }