Exemple #1
0
        /// <summary>
        /// Draw a box at the input location
        /// </summary>
        /// <param name="sb">The spritebatch</param>
        /// <param name="upperLeft">Upper left position</param>
        /// <param name="lowerRight">Lower right position</param>
        /// <param name="c">Color</param>
        public static void DrawBox(SpriteBatch sb, Vector2 upperLeft, Vector2 lowerRight, Color c, int linewidth)
        {
            Rectangle r = MathExtension.RectangleFromVectors(upperLeft, lowerRight);

            DrawLine(sb, r.Left, r.Top, r.Right, r.Top, c, linewidth);
            DrawLine(sb, r.Right, r.Y, r.Right, r.Bottom, c, linewidth);
            DrawLine(sb, r.Right, r.Bottom, r.Left, r.Bottom, c, linewidth);
            DrawLine(sb, r.Left, r.Bottom, r.Left, r.Top, c, linewidth);
        }
Exemple #2
0
        /// <summary>
        /// Draw a filled box at the input location
        /// </summary>
        /// <param name="sb">The spritebatch</param>
        /// <param name="upperLeft">Upper left position</param>
        /// <param name="lowerRight">Lower right position</param>
        /// <param name="c">Color</param>
        public static void DrawBoxFilled(SpriteBatch sb, Vector2 upperLeft, Vector2 lowerRight, Color c)
        {
            Rectangle r = MathExtension.RectangleFromVectors(upperLeft, lowerRight);

            sb.Draw(pixel, r, c);
        }