bool isClicked() { Vector2 origLoc = Location; Matrix rotationMatrix = Matrix.CreateRotationZ(-Rotation); Location = new Vector2(0 - (Texture.Width / 2), 0 - (Texture.Height / 2)); Vector2 rotatedPoint = new Vector2(Game1.mouseState.X, Game1.mouseState.Y); rotatedPoint = Vector2.Transform(rotatedPoint, rotationMatrix); if (Game1.mouseState.LeftButton == ButtonState.Pressed && rotatedPoint.X > Location.X && rotatedPoint.X < Location.X + Texture.Width && rotatedPoint.Y > Location.Y && rotatedPoint.Y < Location.Y + Texture.Height) { Location = origLoc; return true; } Location = origLoc; return false; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)