////////////////

        public override void Draw(SpriteBatch sb)
        {
            Rectangle rect1 = this.GetCategoryPanelRectangle();
            Rectangle rect2 = this.GetTagsPanelRectangle();

            HUDHelpers.DrawBorderedRect(sb, this.Theme.MainBgColor, this.Theme.MainEdgeColor, rect1, 2);
            HUDHelpers.DrawBorderedRect(sb, this.Theme.MainBgColor, this.Theme.MainEdgeColor, rect2, 2);
        }
Esempio n. 2
0
        ////////////////

        public Rectangle DrawColorIcon(SpriteBatch sb, int itemType, Color color, float amountPercent,
                                       int stack, int x, int y, double paletteAngle, double angleStep, bool isSelected)
        {
            bool      hasGlow;
            Texture2D cartTex = this.GetPaintTexture(itemType);
            Texture2D overTex = this.GetPaintOverlayTexture(itemType, out hasGlow);

            bool isHover = this.IsHoveringIcon(paletteAngle, angleStep);

            var   rect     = new Rectangle(x - (cartTex.Width / 2), y - (cartTex.Height / 2), cartTex.Width, cartTex.Height);
            float colorMul = isSelected ? PaintBlasterUI.SelectedScale :
                             (isHover ? PaintBlasterUI.HoveredScale : PaintBlasterUI.IdleScale);

            sb.Draw(cartTex, rect, Color.White * colorMul);
            if (overTex != null)
            {
                sb.Draw(overTex, rect, (hasGlow ? color : color * colorMul));
            }

            if (isHover)
            {
                Color textColor  = ColorCartridgeItem.GetCapacityColor(amountPercent);
                Color labelColor = hasGlow ? Color.GreenYellow * PaintBlasterUI.HoveredScale
                                        : Color.White * PaintBlasterUI.HoveredScale;
                Color bgColor = Color.Black * PaintBlasterUI.HoveredScale;

                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Capacity:", Main.mouseX, Main.mouseY - 16, labelColor, bgColor, default(Vector2), 1f);
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, (int)(amountPercent * 100) + "%", Main.mouseX + 72, Main.mouseY - 16, labelColor, bgColor, default(Vector2), 1f);

                string colorStr = PaintBlasterHelpers.ColorString(color);

                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Color:", Main.mouseX, Main.mouseY + 8, labelColor, bgColor, default(Vector2), 1f);
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, colorStr, Main.mouseX + 56, Main.mouseY + 8, color, bgColor, default(Vector2), 1f);
            }

            if (isSelected)
            {
                Rectangle selRect = rect;
                selRect.X      -= 3;
                selRect.Y      -= 3;
                selRect.Width  += 6;
                selRect.Height += 6;

                HUDHelpers.DrawBorderedRect(sb, Color.Transparent, AnimatedColors.Air.CurrentColor * 0.5f, selRect, 2);
            }

            Utils.DrawBorderStringFourWay(sb, Main.fontItemStack, stack + "", (rect.X + cartTex.Width) - 4, (rect.Y + cartTex.Height) - 12, Color.White, Color.Black, default(Vector2), 1f);

            return(rect);
        }
Esempio n. 3
0
        ////////////////

        public override void Draw(SpriteBatch sb)
        {
            if (!this.IsHidden)
            {
                Rectangle rect = this.GetOuterDimensions().ToRectangle();
                rect.X      += 4;
                rect.Y      += 4;
                rect.Width  -= 4;
                rect.Height -= 5;

                HUDHelpers.DrawBorderedRect(sb, this.GetBgColor(), this.GetEdgeColor(), rect, 2);
            }

            base.Draw(sb);
        }
Esempio n. 4
0
        ////////////////

        public override void Draw(SpriteBatch sb)
        {
            if (!this.IsHidden)
            {
                Rectangle rect = this.GetOuterDimensions().ToRectangle();
                rect.X      += 4;
                rect.Y      += 4;
                rect.Width  -= 4;
                rect.Height -= 5;

                Color bgColor   = this.IsMouseHovering ? this.Theme.ButtonBgLitColor : this.Theme.ButtonBgColor;
                Color edgeColor = this.IsMouseHovering ? this.Theme.ButtonEdgeLitColor : this.Theme.ButtonEdgeColor;

                HUDHelpers.DrawBorderedRect(sb, bgColor, edgeColor, rect, 2);
            }

            this.UpdateTagCounts();

            base.Draw(sb);
        }
        ////////////////

        public void DrawUI(BetterPaintMod mymod, SpriteBatch sb)
        {
            Rectangle streamRect, sprayRect, bucketRect, scrapeRect;
            Rectangle bgRect, sizeRect, copyRect, pressRect;
            int       x = Main.screenWidth / 2;
            int       y = Main.screenHeight / 2;

            sb.Draw(Main.magicPixel, new Rectangle(x, y, 160, 160), null, Color.LightPink * 0.3f, (float)(45d * DotNetHelpers.RadDeg), new Vector2(0.5f, 512f), SpriteEffects.None, 1f);
            HUDHelpers.DrawBorderedRect(sb, Color.DarkOliveGreen * 0.5f, Color.OliveDrab * 0.5f, new Rectangle(x - 48, y - 48, 96, 96), 4);

            this.DrawBrushes(sb, out streamRect, out sprayRect, out bucketRect, out scrapeRect);
            this.DrawOptionLayer(sb, x, y, out bgRect);
            this.DrawOptionSize(sb, x, y, out sizeRect);
            this.DrawOptionCopy(sb, x, y, out copyRect);
            this.DrawOptionPressure(sb, x, y, out pressRect);
            IDictionary <int, float> paletteAngles = this.DrawColorPalette(mymod, sb);

            if (Main.mouseLeft)
            {
                if (!this.IsInteractingWithUI)
                {
                    this.IsInteractingWithUI = true;

                    bool hasInteracted = false;

                    hasInteracted  = this.CheckUISettingsInteractions(bgRect, sizeRect, copyRect, pressRect);
                    hasInteracted |= this.CheckUIBrushInteractions(streamRect, sprayRect, bucketRect, scrapeRect);
                    hasInteracted |= this.CheckUIColorInteractions(paletteAngles);

                    if (hasInteracted)
                    {
                        Main.PlaySound(SoundID.MenuTick);
                    }
                }
            }
            else
            {
                this.IsInteractingWithUI = false;
            }
        }
        ////////////////

        internal static void DrawAllRects(SpriteBatch sb)
        {
            int yPos = 0;

            lock (DebugHelpers.MyRectLock) {
                foreach (string key in DebugHelpers.Rects.Keys.ToList())
                {
                    Rectangle rect  = DebugHelpers.Rects[key];
                    Color     color = Color.White;

                    if (DebugHelpers.RectsShade.ContainsKey(key))
                    {
                        int shade = DebugHelpers.RectsShade[key];
                        if (DebugHelpers.RectsTime.ContainsKey(key))
                        {
                            float timeRatio = (float)DebugHelpers.RectsTime[key] / (float)DebugHelpers.RectsTimeStart[key];
                            shade = (int)Math.Min(255f, 255f * timeRatio);
                        }
                        else
                        {
                            DebugHelpers.RectsShade[key]--;
                        }
                        color.R = color.G = color.B = color.A = (byte)Math.Max(shade, 16);
                    }

                    HUDHelpers.DrawBorderedRect(sb, null, color, rect, 1);

                    if (DebugHelpers.RectsTime.ContainsKey(key))
                    {
                        if (DebugHelpers.RectsTime[key] > 0)
                        {
                            DebugHelpers.RectsTime[key]--;
                        }
                    }
                    yPos += 24;
                }
            }
        }
Esempio n. 7
0
        public void DrawBrushes(SpriteBatch sb, out Rectangle streamRect, out Rectangle sprayRect, out Rectangle spatterRect,
                                out Rectangle eraserRect)
        {
            int   brushesDist = PaintBlasterUI.BrushesRingRadius;
            float hilit       = PaintBlasterUI.SelectedScale;
            float lit         = PaintBlasterUI.HoveredScale;
            float unlit       = PaintBlasterUI.IdleScale;
            int   x           = Main.screenWidth / 2;
            int   y           = Main.screenHeight / 2;

            /*Texture2D tex_stream = Main.itemTexture[ItemID.Paintbrush];
             * Texture2D tex_spray = Main.itemTexture[ItemID.PaintSprayer];
             * Texture2D tex_spatter = Main.itemTexture[ItemID.HoneyBucket];
             * Texture2D tex_eraser = Main.itemTexture[ItemID.PaintScraper];*/
            Texture2D texStream  = PaintBlasterUI.BrushStream;
            Texture2D texSpray   = PaintBlasterUI.BrushSpray;
            Texture2D texSpatter = PaintBlasterUI.BrushSpatter;
            Texture2D texEraser  = PaintBlasterUI.BrushEraser;

            var streamOffset  = new Vector2(texStream.Width, texStream.Height) * 0.5f;
            var sprayOffset   = new Vector2(texSpray.Width, texSpray.Height) * 0.5f;
            var spatterOffset = new Vector2(texSpatter.Width, texSpatter.Height) * 0.5f;
            var eraserOffset  = new Vector2(texEraser.Width, texEraser.Height) * 0.5f;

            streamRect  = new Rectangle((int)((x - brushesDist) - streamOffset.X), (int)(y - streamOffset.Y), texStream.Width, texStream.Height);
            sprayRect   = new Rectangle((int)(x - sprayOffset.X), (int)((y - brushesDist) - sprayOffset.Y), texSpray.Width, texSpray.Height);
            spatterRect = new Rectangle((int)((x + brushesDist) - spatterOffset.X), (int)(y - spatterOffset.Y), texSpatter.Width, texSpatter.Height);
            eraserRect  = new Rectangle((int)(x - eraserOffset.X), (int)((y + brushesDist) - eraserOffset.Y), texEraser.Width, texEraser.Height);

            bool streamHover  = streamRect.Contains(Main.mouseX, Main.mouseY);
            bool sprayHover   = streamHover ? false : sprayRect.Contains(Main.mouseX, Main.mouseY);
            bool spatterHover = sprayHover ? false : spatterRect.Contains(Main.mouseX, Main.mouseY);
            bool eraserHover  = spatterHover ? false : eraserRect.Contains(Main.mouseX, Main.mouseY);

            sb.Draw(texStream, streamRect, Color.White * (this.CurrentBrush == PaintBrushType.Stream ? hilit : (streamHover ? lit : unlit)));
            sb.Draw(texSpray, sprayRect, Color.White * (this.CurrentBrush == PaintBrushType.Spray ? hilit : (sprayHover ? lit : unlit)));
            sb.Draw(texSpatter, spatterRect, Color.White * (this.CurrentBrush == PaintBrushType.Spatter ? hilit : (spatterHover ? lit : unlit)));
            sb.Draw(texEraser, eraserRect, Color.White * (this.CurrentBrush == PaintBrushType.Erase ? hilit : (eraserHover ? lit : unlit)));

            if (streamHover)
            {
                var toolColor = this.CurrentBrush == PaintBrushType.Stream ? Color.White : Color.LightGray;
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Stream Mode", streamRect.X, streamRect.Y + streamRect.Height, toolColor, Color.Black, default(Vector2), 1f);
            }
            else if (sprayHover)
            {
                var toolColor = this.CurrentBrush == PaintBrushType.Spray ? Color.White : Color.LightGray;
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Spray Mode", sprayRect.X, sprayRect.Y + sprayRect.Height, toolColor, Color.Black, default(Vector2), 1f);
            }
            else if (spatterHover)
            {
                var toolColor = this.CurrentBrush == PaintBrushType.Spatter ? Color.White : Color.LightGray;
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Spatter Mode", spatterRect.X, spatterRect.Y + spatterRect.Height, toolColor, Color.Black, default(Vector2), 1f);
            }
            else if (eraserHover)
            {
                var toolColor = this.CurrentBrush == PaintBrushType.Erase ? Color.White : Color.LightGray;
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Eraser Mode", eraserRect.X, eraserRect.Y + eraserRect.Height, toolColor, Color.Black, default(Vector2), 1f);
            }

            switch (this.CurrentBrush)
            {
            case PaintBrushType.Stream:
                HUDHelpers.DrawBorderedRect(sb, Color.Transparent, AnimatedColors.Air.CurrentColor * 0.5f, streamRect, 2);
                break;

            case PaintBrushType.Spray:
                HUDHelpers.DrawBorderedRect(sb, Color.Transparent, AnimatedColors.Air.CurrentColor * 0.5f, sprayRect, 2);
                break;

            case PaintBrushType.Spatter:
                HUDHelpers.DrawBorderedRect(sb, Color.Transparent, AnimatedColors.Air.CurrentColor * 0.5f, spatterRect, 2);
                break;

            case PaintBrushType.Erase:
                HUDHelpers.DrawBorderedRect(sb, Color.Transparent, AnimatedColors.Air.CurrentColor * 0.5f, eraserRect, 2);
                break;
            }
        }