internal bool CheckShiftPressed(ShiftKeys key) { if (GamePadShiftMappings.Any(x => x.Key == key)) { for (int i = 0; i < 4; i++) { if (gamepadState[i].IsConnected) { KeyValuePair<ShiftKeys, Buttons> found = GamePadShiftMappings.FirstOrDefault(x => x.Key == key); Buttons mapping = found.Value; if (gamepadState[i].IsButtonDown(mapping)) { return true; } } } } if (KeyboardShiftMappings.ContainsKey(key)) { var keyToCheck = KeyboardShiftMappings[key]; if (keyboardState.IsKeyDown(keyToCheck)) { return true; } } return false; }
public bool IsPressed(ActionKeys key, ShiftKeys shift) { return(newState.ShiftPressed(shift) && (newState.CheckPressed(key))); }
public bool JustReleased(ActionKeys key, ShiftKeys shift) { return(newState.ShiftPressed(shift) && ((oldState.CheckPressed(key) && !newState.CheckPressed(key)))); }
public bool IsPressed(ShiftKeys shift) { return(newState.ShiftPressed(shift)); }
internal bool ShiftPressed(ShiftKeys shift) { if (shift == ShiftKeys.DontCare) { return(true); } if (shift == ShiftKeys.NoShift) { return (!CheckShiftPressed(ShiftKeys.LeftShift1) && !CheckShiftPressed(ShiftKeys.RightShift1) && !CheckShiftPressed(ShiftKeys.LeftShift2) && !CheckShiftPressed(ShiftKeys.RightShift2) && !CheckShiftPressed(ShiftKeys.LeftShift3) && !CheckShiftPressed(ShiftKeys.RightShift3)); } if (shift == ShiftKeys.LeftShift1) { return(CheckShiftPressed(ShiftKeys.LeftShift1)); } if (shift == ShiftKeys.LeftShift2) { return(CheckShiftPressed(ShiftKeys.LeftShift2)); } if (shift == ShiftKeys.LeftShift3) { return(CheckShiftPressed(ShiftKeys.LeftShift3)); } if (shift == ShiftKeys.RightShift1) { return(CheckShiftPressed(ShiftKeys.RightShift1)); } if (shift == ShiftKeys.RightShift2) { return(CheckShiftPressed(ShiftKeys.RightShift2)); } if (shift == ShiftKeys.RightShift3) { return(CheckShiftPressed(ShiftKeys.RightShift3)); } if (shift == ShiftKeys.Shift1) { return(CheckShiftPressed(ShiftKeys.LeftShift1) || CheckShiftPressed(ShiftKeys.RightShift1)); } if (shift == ShiftKeys.Shift2) { return(CheckShiftPressed(ShiftKeys.LeftShift2) || CheckShiftPressed(ShiftKeys.RightShift2)); } if (shift == ShiftKeys.Shift3) { return(CheckShiftPressed(ShiftKeys.LeftShift3) || CheckShiftPressed(ShiftKeys.RightShift3)); } if (shift == ShiftKeys.AnyShift) { return (CheckShiftPressed(ShiftKeys.LeftShift1) || CheckShiftPressed(ShiftKeys.RightShift1) || CheckShiftPressed(ShiftKeys.LeftShift2) || CheckShiftPressed(ShiftKeys.RightShift2) || CheckShiftPressed(ShiftKeys.LeftShift3) || CheckShiftPressed(ShiftKeys.RightShift3)); } return(false); }
internal bool CheckShiftPressed(ShiftKeys key) => shiftstates.ContainsKey(key) && shiftstates[key];