Clone wiki

2D XNA Primitives / DrawRectangle

DrawRectangle

Draws a rectangle, not to be confused with FillRectangle.

public static void DrawRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color, float thickness = 1f)
Parameter NameDescription
spriteBatchThe destination drawing surface
rectThe rectangle to draw
colorThe color to draw the rectangle in
thicknessThe thickness of the lines. Default = 1f
public static void DrawRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color, float thickness = 1f)
Parameter NameDescription
spriteBatchThe destination drawing surface
locationThe top left corner of the rectangle to draw
sizeThe width and height of the rectangle to draw
colorThe color to draw the rectangle in
thicknessThe thickness of the lines. Default = 1f

Updated