/** * @brief function for dealing with xbox controller analog inputs * @see * @param * @param * @param * @param * @param * @param * @param * @return direction state the discrete movement from the xbox controller * @pre * @post */ public keyStates LeftGamePadHandler() { // get gamepad input gamePadInput = GamePad.GetState(PlayerIndex.One); keyStates directionState = keyStates.NULL; if (gamePadInput.IsConnected) { if (gamePadInput.DPad.Up == ButtonState.Pressed) { directionState = keyStates.Forwards; } if (gamePadInput.DPad.Down == ButtonState.Pressed) { directionState = keyStates.Backwards; } if (gamePadInput.DPad.Left == ButtonState.Pressed) { directionState = keyStates.Left; } if (gamePadInput.DPad.Right == ButtonState.Pressed) { directionState = keyStates.Right; } if (gamePadInput.Buttons.RightShoulder == ButtonState.Pressed) { directionState = keyStates.CW; } if (gamePadInput.Buttons.LeftShoulder == ButtonState.Pressed) { Debug.WriteLine("Pressed Q"); directionState = keyStates.CCW; } if (keyboardInput.IsKeyDown(Keys.D1)) { directionState = keyStates.FPS; } if (keyboardInput.IsKeyDown(Keys.D2)) { directionState = keyStates.Pigeon; } } // this is a hack return(directionState); }
/** * @brief function for dealing with keyboardinputs * @see * @param * @param * @param * @param * @param * @param * @param * @return direction state the discrete movement from the keyboard * @pre * @post */ public keyStates KeyboardHandler() { keyboardInput = Keyboard.GetState(); keyStates directionState = keyStates.NULL; if (keyboardInput.IsKeyDown(Keys.W)) { Debug.WriteLine("KeyDown W!!!"); directionState = keyStates.Forwards; } if (keyboardInput.IsKeyDown(Keys.S)) { directionState = keyStates.Backwards; } if (keyboardInput.IsKeyDown(Keys.A)) { directionState = keyStates.Left; } if (keyboardInput.IsKeyDown(Keys.D)) { directionState = keyStates.Right; } if (keyboardInput.IsKeyDown(Keys.E)) { directionState = keyStates.CW; } if (keyboardInput.IsKeyDown(Keys.Q)) { Debug.WriteLine("Pressed Q"); directionState = keyStates.CCW; } if (keyboardInput.IsKeyDown(Keys.D1)) { directionState = keyStates.FPS; } if (keyboardInput.IsKeyDown(Keys.D2)) { directionState = keyStates.Pigeon; } if (keyboardInput.IsKeyDown(Keys.Z)) { directionState = keyStates.ZoomIn; } if (keyboardInput.IsKeyDown(Keys.C)) { directionState = keyStates.ZoomOut; } // this is a hack return(directionState); }