public bool Down(InputDetectionType detectionType, DirectionalInputTypes inputTypes) { // todo: for all directions: check if game is active! if (inputTypes.HasFlag(DirectionalInputTypes.ScrollWheel) && Mouse.GetScrollWheelDifference() < 0) { return(true); } else if (inputTypes != DirectionalInputTypes.ScrollWheel) // when it's only scroll wheel, do not check the rest. { return(CheckDirectional(detectionType, InputDirection.Down, inputTypes, Keys.Down, Keys.S, Buttons.LeftThumbstickDown, Buttons.RightThumbstickDown, Buttons.DPadDown)); } return(false); }
private bool CheckDirectional(InputDetectionType detectionType, InputDirection direction, DirectionalInputTypes inputTypes, Keys arrowKey, Keys WASDKey, Buttons leftThumbstick, Buttons rightThumbstick, Buttons dPadDirection) { switch (detectionType) { case InputDetectionType.PressedOnce: return CheckDirectionalPressedOnce(direction, inputTypes, arrowKey, WASDKey, leftThumbstick, rightThumbstick, dPadDirection); case InputDetectionType.HeldDown: return CheckDirectionalHeldDown(inputTypes, arrowKey, WASDKey, leftThumbstick, rightThumbstick, dPadDirection); case InputDetectionType.Released: return CheckDirectionalReleased(inputTypes, arrowKey, WASDKey, leftThumbstick, rightThumbstick, dPadDirection); } return false; }
private bool CheckDirectionalReleased(DirectionalInputTypes inputTypes, Keys arrowKey, Keys WASDKey, Buttons leftThumbstick, Buttons rightThumbstick, Buttons dPadDirection) { if (inputTypes.HasFlag(DirectionalInputTypes.ArrowKeys)) { if (Keyboard.IsKeyUp(arrowKey)) { return(true); } } if (inputTypes.HasFlag(DirectionalInputTypes.WASD)) { if (Keyboard.IsKeyUp(WASDKey)) { return(true); } } if (inputTypes.HasFlag(DirectionalInputTypes.LeftThumbstick)) { if (GamePad.IsButtonUp(leftThumbstick)) { return(true); } } if (inputTypes.HasFlag(DirectionalInputTypes.RightThumbstick)) { if (GamePad.IsButtonUp(rightThumbstick)) { return(true); } } if (inputTypes.HasFlag(DirectionalInputTypes.DPad)) { if (GamePad.IsButtonUp(dPadDirection)) { return(true); } } return(false); }
private bool CheckDirectionalPressedOnce(InputDirection direction, DirectionalInputTypes inputTypes, Keys arrowKey, Keys WASDKey, Buttons leftThumbstick, Buttons rightThumbstick, Buttons dPadDirection) { bool hasAnyCommand = false; if (inputTypes.HasFlag(DirectionalInputTypes.WASD)) { if (Keyboard.IsKeyDown(WASDKey)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return(true); } else { if (Keyboard.IsKeyDownOnce(WASDKey)) { ChangePressedDirection(direction); return(true); } } } } if (inputTypes.HasFlag(DirectionalInputTypes.ArrowKeys)) { if (Keyboard.IsKeyDown(arrowKey)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return(true); } else { if (Keyboard.IsKeyDownOnce(arrowKey)) { ChangePressedDirection(direction); return(true); } } } } if (inputTypes.HasFlag(DirectionalInputTypes.LeftThumbstick)) { if (GamePad.IsButtonDown(leftThumbstick)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return(true); } else { if (GamePad.IsButtonDownOnce(leftThumbstick)) { ChangePressedDirection(direction); return(true); } } } } if (inputTypes.HasFlag(DirectionalInputTypes.RightThumbstick)) { if (GamePad.IsButtonDown(rightThumbstick)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return(true); } else { if (GamePad.IsButtonDownOnce(rightThumbstick)) { ChangePressedDirection(direction); return(true); } } } } if (inputTypes.HasFlag(DirectionalInputTypes.DPad)) { if (GamePad.IsButtonDown(dPadDirection)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return(true); } else { if (GamePad.IsButtonDownOnce(dPadDirection)) { ChangePressedDirection(direction); return(true); } } } } if (!hasAnyCommand) { ResetPressedDirection(direction); } return(false); }
private bool CheckDirectional(InputDetectionType detectionType, InputDirection direction, DirectionalInputTypes inputTypes, Keys arrowKey, Keys WASDKey, Buttons leftThumbstick, Buttons rightThumbstick, Buttons dPadDirection) { switch (detectionType) { case InputDetectionType.PressedOnce: return(CheckDirectionalPressedOnce(direction, inputTypes, arrowKey, WASDKey, leftThumbstick, rightThumbstick, dPadDirection)); case InputDetectionType.HeldDown: return(CheckDirectionalHeldDown(inputTypes, arrowKey, WASDKey, leftThumbstick, rightThumbstick, dPadDirection)); case InputDetectionType.Released: return(CheckDirectionalReleased(inputTypes, arrowKey, WASDKey, leftThumbstick, rightThumbstick, dPadDirection)); } return(false); }
private bool CheckDirectionalPressedOnce(InputDirection direction, DirectionalInputTypes inputTypes, Keys arrowKey, Keys WASDKey, Buttons leftThumbstick, Buttons rightThumbstick, Buttons dPadDirection) { bool hasAnyCommand = false; if (inputTypes.HasFlag(DirectionalInputTypes.WASD)) { if (Keyboard.IsKeyDown(WASDKey)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return true; } else { if (Keyboard.IsKeyDownOnce(WASDKey)) { ChangePressedDirection(direction); return true; } } } } if (inputTypes.HasFlag(DirectionalInputTypes.ArrowKeys)) { if (Keyboard.IsKeyDown(arrowKey)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return true; } else { if (Keyboard.IsKeyDownOnce(arrowKey)) { ChangePressedDirection(direction); return true; } } } } if (inputTypes.HasFlag(DirectionalInputTypes.LeftThumbstick)) { if (GamePad.IsButtonDown(leftThumbstick)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return true; } else { if (GamePad.IsButtonDownOnce(leftThumbstick)) { ChangePressedDirection(direction); return true; } } } } if (inputTypes.HasFlag(DirectionalInputTypes.RightThumbstick)) { if (GamePad.IsButtonDown(rightThumbstick)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return true; } else { if (GamePad.IsButtonDownOnce(rightThumbstick)) { ChangePressedDirection(direction); return true; } } } } if (inputTypes.HasFlag(DirectionalInputTypes.DPad)) { if (GamePad.IsButtonDown(dPadDirection)) { hasAnyCommand = true; if (HoldDownPress(direction)) { return true; } else { if (GamePad.IsButtonDownOnce(dPadDirection)) { ChangePressedDirection(direction); return true; } } } } if (!hasAnyCommand) ResetPressedDirection(direction); return false; }
public bool Down(InputDetectionType detectionType, DirectionalInputTypes inputTypes) { // todo: for all directions: check if game is active! if (inputTypes.HasFlag(DirectionalInputTypes.ScrollWheel) && Mouse.GetScrollWheelDifference() < 0) { return true; } else if (inputTypes != DirectionalInputTypes.ScrollWheel) // when it's only scroll wheel, do not check the rest. { return CheckDirectional(detectionType, InputDirection.Down, inputTypes, Keys.Down, Keys.S, Buttons.LeftThumbstickDown, Buttons.RightThumbstickDown, Buttons.DPadDown); } return false; }
private bool CheckDirectionalReleased(DirectionalInputTypes inputTypes, Keys arrowKey, Keys WASDKey, Buttons leftThumbstick, Buttons rightThumbstick, Buttons dPadDirection) { if (inputTypes.HasFlag(DirectionalInputTypes.ArrowKeys)) if (Keyboard.IsKeyUp(arrowKey)) return true; if (inputTypes.HasFlag(DirectionalInputTypes.WASD)) if (Keyboard.IsKeyUp(WASDKey)) return true; if (inputTypes.HasFlag(DirectionalInputTypes.LeftThumbstick)) if (GamePad.IsButtonUp(leftThumbstick)) return true; if (inputTypes.HasFlag(DirectionalInputTypes.RightThumbstick)) if (GamePad.IsButtonUp(rightThumbstick)) return true; if (inputTypes.HasFlag(DirectionalInputTypes.DPad)) if (GamePad.IsButtonUp(dPadDirection)) return true; return false; }