private void UpdateMouse() { previousMouse = currentMouse; currentMouse = Mouse.GetState(); Rectangle mouseRectangle = Factory.CreateRectangle(currentMouse.X, currentMouse.Y, 1, 1); isHovering = false; if (mouseRectangle.Intersects(Rectangle)) { isHovering = true; if (wasHovering == false) { MenuSounds.PlaySelectSound(); } if (currentMouse.LeftButton == ButtonState.Released && previousMouse.LeftButton == ButtonState.Pressed) { Click?.Invoke(this, new EventArgs()); } } wasHovering = isHovering; }
public override void Update(GameTime gameTime) { if (TouchController.isPressed()) { MenuSounds.PlaySelectSound(); StartGame(); } }