/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> public void OnButtonPressed(object sender, ButtonPressedEventArgs e) { if (e.Button == SButton.MouseLeft || e.Button == SButton.ControllerA) { int x = (int)e.Cursor.ScreenPixels.X; int y = (int)e.Cursor.ScreenPixels.Y; if (isWithinBounds(x, y)) { receiveLeftClick(x, y); OnLeftClicked?.Invoke(this, null); } } //if (e.NewState.LeftButton != ButtonState.Pressed || !(Game1.activeClickableMenu is GameMenu)) //{ // _hasClicked = false; //} //else if ((Game1.activeClickableMenu as GameMenu).currentTab != 3 && // isWithinBounds(e.NewPosition.X, e.NewPosition.Y) && // !_hasClicked) //{ // receiveLeftClick(e.NewPosition.X, e.NewPosition.Y); //} }
private void ControlEvents_ControllerButtonPressed(object sender, EventArgsControllerButtonPressed e) { if (e.ButtonPressed == Buttons.A && isWithinBounds(Game1.getMouseX(), Game1.getMouseY())) { receiveLeftClick(Game1.getMouseX(), Game1.getMouseY()); OnLeftClicked?.Invoke(this, null); } }
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> public void OnButtonPressed(object sender, ButtonPressedEventArgs e) { if (e.Button == SButton.MouseLeft || e.Button == SButton.ControllerA) { var x = (int)Utility.ModifyCoordinateForUIScale(e.Cursor.ScreenPixels.X); var y = (int)Utility.ModifyCoordinateForUIScale(e.Cursor.ScreenPixels.Y); if (isWithinBounds(x, y)) { receiveLeftClick(x, y); OnLeftClicked?.Invoke(this, null); } } }
/// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> public void OnButtonPressed(object sender, ButtonPressedEventArgs e) { if (e.Button == SButton.MouseLeft || e.Button == SButton.ControllerA) { int x = (int)e.Cursor.ScreenPixels.X; int y = (int)e.Cursor.ScreenPixels.Y; if (isWithinBounds(x, y)) { receiveLeftClick(x, y); OnLeftClicked?.Invoke(this, null); } } }
public void OnMouseChanged(object sender, EventArgsMouseStateChanged e) { if (e.PriorState.LeftButton != ButtonState.Pressed && e.NewState.LeftButton == ButtonState.Pressed && isWithinBounds(e.NewPosition.X, e.NewPosition.Y)) { receiveLeftClick(e.NewPosition.X, e.NewPosition.Y); OnLeftClicked?.Invoke(this, null); } //if (e.NewState.LeftButton != ButtonState.Pressed || !(Game1.activeClickableMenu is GameMenu)) //{ // _hasClicked = false; //} //else if ((Game1.activeClickableMenu as GameMenu).currentTab != 3 && // isWithinBounds(e.NewPosition.X, e.NewPosition.Y) && // !_hasClicked) //{ // receiveLeftClick(e.NewPosition.X, e.NewPosition.Y); //} }