//////////////// /// <summary> /// Gets the scaled dimensions of a given width and height as if projectected onto the overlay map. /// </summary> /// <param name="width"></param> /// <param name="height"></param> /// <returns></returns> public static Vector2 GetSizeOnOverlayMap(float width, float height) //Main.mapStyle == 2 { float baseX = Main.screenPosition.X; float baseY = Main.screenPosition.Y; Vector2 mapBasePos = HUDMapLibraries.GetOverlayMapPositionAsScreenPosition(new Rectangle((int)baseX, (int)baseY, 0, 0)).ScreenPosition; Vector2 mapNewPos = HUDMapLibraries.GetOverlayMapPositionAsScreenPosition(new Rectangle((int)(baseX + width), (int)(baseY + height), 0, 0)).ScreenPosition; return(mapNewPos - mapBasePos); }
//////////////// /// <summary> /// Returns a screen position of a given world position as if projected onto the overlay map. /// </summary> /// <param name="worldPosition"></param> /// <returns>A tuple indicating the screen-relative position and whether the point is within the screen /// boundaries.</returns> public static (Vector2 ScreenPosition, bool IsOnScreen) GetOverlayMapPositionAsScreenPosition(Vector2 worldPosition) //Main.mapStyle == 2 { return(HUDMapLibraries.GetOverlayMapPositionAsScreenPosition( new Rectangle((int)worldPosition.X, (int)worldPosition.Y, 0, 0) )); }