using Microsoft.Xna.Framework; namespace StardewModdingAPI.Framework { /// Defines a position on a given map at different reference points. internal class CursorPosition : ICursorPosition { /********* ** Accessors *********/ /// The raw pixel position, not adjusted for the game zoom. public Vector2 RawPixels { get; } /// The pixel position relative to the top-left corner of the visible screen. public Vector2 ScreenPixels { get; } /// The tile position under the cursor relative to the top-left corner of the map. public Vector2 Tile { get; } /// The tile position that the game considers under the cursor for purposes of clicking actions. This may be different than if that's too far from the player. public Vector2 GrabTile { get; } /********* ** Public methods *********/ /// Construct an instance. /// The raw pixel position, not adjusted for the game zoom. /// The pixel position relative to the top-left corner of the visible screen. /// The tile position relative to the top-left corner of the map. /// The tile position that the game considers under the cursor for purposes of clicking actions. public CursorPosition(Vector2 rawPixels, Vector2 screenPixels, Vector2 tile, Vector2 grabTile) { this.RawPixels = rawPixels; this.ScreenPixels = screenPixels; this.Tile = tile; this.GrabTile = grabTile; } /// Get whether the current object is equal to another object of the same type. /// An object to compare with this object. public bool Equals(ICursorPosition other) { return other != null && this.ScreenPixels == other.ScreenPixels; } } }