示例#1
0
    /// <summary>
    /// Draws a rectangle without filling the middle.
    /// </summary>
    /// <param name="sb">The SpriteBatch used for this rectangle draw.</param>
    /// <param name="pos">The position, top-left, of the rectangle.</param>
    /// <param name="size">The size of the rectangle.</param>
    /// <param name="c">The color of the rectangle.</param>
    /// <param name="layer">The layer on which to draw the rectangle.</param>
    public static void DrawEmptyRectangle(SpriteBatch sb, Vector2 pos, Vector2 size, Color c, float layer)
    {
        Vector2 topLeft     = pos;
        Vector2 topRight    = new Vector2(pos.X + size.X, pos.Y);
        Vector2 bottomRight = new Vector2(pos.X + size.X, pos.Y + size.Y);
        Vector2 bottomLeft  = new Vector2(pos.X, pos.Y + size.Y);

        DrawingTools.DrawLine(sb, topLeft, topRight, c, layer);
        DrawingTools.DrawLine(sb, topRight, bottomRight, c, layer);
        DrawingTools.DrawLine(sb, bottomRight, bottomLeft, c, layer);
        DrawingTools.DrawLine(sb, bottomLeft, topLeft, c, layer);
    }