/// <summary> /// Single presses only, no drag and hold. /// </summary> /// <param name="state"></param> /// <returns></returns> static public bool isMousePressed(ButtonState state) { if (!KeyboardMouseUtility.AnyButtonsPressed() && Game1.bIsActive && state == ButtonState.Pressed) { return(true); } return(false); }
private static void GlobalControls(ActionKey key) { if (ExpGainScreen.bLevelledUp) { if (key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed()) { ExpGainScreen.ConfirmPress(); } } else if (ExpGainScreen.bDoneGivingExp) { if (key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed()) { ExpGainScreen.ConfirmPress(); } } }
static public bool isPressed(String keyString) { foreach (Actions.Actions action in Game1.actionList) { if (action.actionIndentifierString.Equals(keyString)) { foreach (ActionKey key in action.whatKeysIsActionAssignedTo) { if ((Keyboard.GetState().IsKeyDown(key.identifyKey(keyString))) && !KeyboardMouseUtility.AnyButtonsPressed()) { bPressed = true; buttonControl.elapsedMilliseconds = 0; return(true); } if (key.bKeyIsGamePadKey && GamePad.GetState(PlayerIndex.One).IsButtonDown(key.identifyButton(keyString)) && !KeyboardMouseUtility.AnyButtonsPressed() && !GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.LeftThumbstickDown)) { bPressed = true; buttonControl.elapsedMilliseconds = 0; return(true); } else if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.LeftThumbstickDown) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (keyString.Equals(Game1.moveDownString) && GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y < 0) { bPressed = true; buttonControl.elapsedMilliseconds = 0; return(true); } else if (keyString.Equals(Game1.moveUpString) && GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y > 0) { bPressed = true; buttonControl.elapsedMilliseconds = 0; return(true); } } } } } return(false); }