예제 #1
0
        ////////////////

        /// <summary>
        /// Gets the scaled dimensions of a given width and height as if projectected onto the mini-map.
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public static Vector2 GetSizeOnMinimap(float width, float height)               //Main.mapStyle == 1
        {
            float baseX = Main.screenPosition.X;
            float baseY = Main.screenPosition.Y;

            Vector2 mapBasePos = HUDMapLibraries.GetMiniMapPositionAsScreenPosition(new Rectangle((int)baseX, (int)baseY, 0, 0)).ScreenPosition;
            Vector2 mapNewPos  = HUDMapLibraries.GetMiniMapPositionAsScreenPosition(new Rectangle((int)(baseX + width), (int)(baseY + height), 0, 0)).ScreenPosition;

            return(mapNewPos - mapBasePos);
        }
예제 #2
0
        ////////////////

        /// <summary>
        /// Returns a screen position of a given world position as if projected onto the mini-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) GetMiniMapPositionAsScreenPosition(Vector2 worldPosition)                //Main.mapStyle == 1
        {
            return(HUDMapLibraries.GetMiniMapPositionAsScreenPosition(new Rectangle((int)worldPosition.X, (int)worldPosition.Y, 0, 0)));
        }