From 456480ef918fc4d864b425fb7a8779618a91475a Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 2 Jan 2021 15:02:58 -0500 Subject: fix cursor position incorrectly handling UI mode (#741) --- src/SMAPI/ICursorPosition.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/SMAPI/ICursorPosition.cs') diff --git a/src/SMAPI/ICursorPosition.cs b/src/SMAPI/ICursorPosition.cs index 21c57db0..99c1b84d 100644 --- a/src/SMAPI/ICursorPosition.cs +++ b/src/SMAPI/ICursorPosition.cs @@ -1,15 +1,19 @@ using System; using Microsoft.Xna.Framework; +using StardewValley; namespace StardewModdingAPI { /// Represents a cursor position in the different coordinate systems. public interface ICursorPosition : IEquatable { - /// The pixel position relative to the top-left corner of the in-game map. + /********* + ** Accessors + *********/ + /// The pixel position relative to the top-left corner of the in-game map, adjusted for zoom but not UI scaling. See also . Vector2 AbsolutePixels { get; } - /// The pixel position relative to the top-left corner of the visible screen. + /// The pixel position relative to the top-left corner of the visible screen, adjusted for zoom but not UI scaling. See also . Vector2 ScreenPixels { get; } /// The tile position under the cursor relative to the top-left corner of the map. @@ -17,5 +21,15 @@ namespace StardewModdingAPI /// 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. Vector2 GrabTile { get; } + + + /********* + ** Public methods + *********/ + /// Get the , adjusted for UI scaling if needed. This is only different if is true. + Vector2 GetScaledAbsolutePixels(); + + /// Get the , adjusted for UI scaling if needed. This is only different if is true. + Vector2 GetScaledScreenPixels(); } } -- cgit