public static bool IsKeyPressedWithModKey(this Keys key, Keys modKey, EKeyboardCheckMode checkMode = EKeyboardCheckMode.Check_Only_Ctrl_Shift_Alt) { return(GameFuncs.IsKeyCombinationPressed(key, modKey, checkMode)); }
public static bool IsKeyCombinationPressed(Keys key, Keys modKey = Keys.None, EKeyboardCheckMode checkMode = EKeyboardCheckMode.Check_Only_Ctrl_Shift_Alt) { if (modKey == Keys.None) { if (Game.IsKeyDown(key)) { KeyboardState kbState = Game.GetKeyboardState(); if (checkMode == EKeyboardCheckMode.Check_Only_Ctrl_Shift_Alt) { // Check if any of the 'regular' mod keys are pressed return(!kbState.IsControlDown && !kbState.IsShiftDown && !kbState.IsAltDown); } else { // Check if PressedKeys contains any elements that are not equal to the currently pressed key return(kbState.PressedKeys.Any(x => x != key)); } } else { return(false); } } else { return(Game.IsKeyDown(key) && Game.IsKeyDownRightNow(modKey)); } }