Exemplo n.º 1
0
        public void DrawOverlayMap(WormholeModContext ctx, WormholeLink link, SpriteBatch sb)
        {
            var mymod = ctx.MyMod;

            if (!link.IsCharted(Main.LocalPlayer) && !mymod.IsDebugWormholeViewMode())
            {
                return;
            }

            float     scale = Main.mapOverlayScale / 1.5f;
            Texture2D tex   = WormholesUI.Tex;

            Rectangle l_rect = new Rectangle((int)link.LeftPortal.Pos.X, (int)link.LeftPortal.Pos.Y, tex.Width, tex.Height);
            Rectangle r_rect = new Rectangle((int)link.RightPortal.Pos.X, (int)link.RightPortal.Pos.Y, tex.Width, tex.Height);

            Vector2?l_pos = HudMapHelpers.GetOverlayMapPosition(l_rect);

            if (l_pos != null)
            {
                Color l_color = link.LeftPortal.BaseColor * Main.mapOverlayAlpha;
                sb.Draw(tex, (Vector2)l_pos, this.TexAnim.Frame, l_color, 0f, new Vector2(), scale, SpriteEffects.None, 1f);
            }

            Vector2?r_pos = HudMapHelpers.GetOverlayMapPosition(r_rect);

            if (r_pos != null)
            {
                Color r_color = link.RightPortal.BaseColor * Main.mapOverlayAlpha;
                sb.Draw(tex, (Vector2)r_pos, this.TexAnim.Frame, r_color, 0f, new Vector2(), scale, SpriteEffects.None, 1f);
            }
        }
        public static void DrawToFullMap(SpriteBatch sb, Texture2D tex, Color color, Vector2 center, bool isZoomed, float scale)
        {
            float myScale = (isZoomed ? Main.mapFullscreenScale : 1f) * scale;

            int tileX = (int)center.X - (int)((float)tex.Width * scale * 8);
            int tileY = (int)center.Y - (int)((float)tex.Height * scale * 8);

            var mapRectOrigin = new Rectangle(tileX, tileY, tex.Width, tex.Height);
            var overMapData   = HudMapHelpers.GetFullMapScreenPosition(mapRectOrigin);

            if (overMapData.Item2)
            {
                sb.Draw(tex, overMapData.Item1, null, color, 0f, default(Vector2), myScale, SpriteEffects.None, 1f);
            }
        }
Exemplo n.º 3
0
        public void DrawFullscreenMap(WormholeModContext ctx, WormholeLink link, SpriteBatch sb)
        {
            var mymod = ctx.MyMod;

            if (!link.IsCharted(Main.LocalPlayer) && !mymod.IsDebugWormholeViewMode())
            {
                return;
            }

            float     scale = Main.mapFullscreenScale / 1.5f;
            Texture2D tex   = WormholesUI.Tex;

            Rectangle l_rect = new Rectangle((int)link.LeftPortal.Pos.X, (int)link.LeftPortal.Pos.Y, tex.Width, tex.Height);
            Vector2   l_pos  = HudMapHelpers.GetFullMapPosition(l_rect);

            sb.Draw(tex, l_pos, this.TexAnim.Frame, link.LeftPortal.BaseColor, 0f, new Vector2 {
            }, scale, SpriteEffects.None, 1f);

            Rectangle r_rect = new Rectangle((int)link.RightPortal.Pos.X, (int)link.RightPortal.Pos.Y, tex.Width, tex.Height);
            Vector2   r_pos  = HudMapHelpers.GetFullMapPosition(r_rect);

            sb.Draw(tex, r_pos, this.TexAnim.Frame, link.RightPortal.BaseColor, 0f, new Vector2 {
            }, scale, SpriteEffects.None, 1f);
        }