Clone wiki

2D XNA Primitives / FillRectangle

FillRectangle

Fills a rectangle

public static void FillRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color)
Parameter NameDescription
spriteBatchThe destination drawing surface
rectThe rectangle to draw
colorThe color to draw the rectangle in

Fills a rotated rectangle

public static void FillRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color, float angle)
Parameter NameDescription
spriteBatchThe destination drawing surface
rectThe rectangle to draw
colorThe color to draw the rectangle in
angleThe angle to draw the rectangle at

Fills a rotated rectangle, specified using a location and size

public static void FillRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color, float angle = 0f)
Parameter NameDescription
spriteBatchThe destination drawing surface
locationWhere to draw
sizeThe size of the rectangle
colorThe color to draw the rectangle in
angleThe angle to draw the rectangle at. Default = 0f

Fills a rotated rectangle, specified by using the coordinates of the rectangle before any rotation has occurred

public static void FillRectangle(this SpriteBatch spriteBatch, float x1, float y1, float x2, float y2, Color color, float angle = 0f)
Parameter NameDescription
spriteBatchThe destination drawing surface
x1The X coord of the left side
y1The Y coord of the upper side
x2The X coord of the right side
y2The Y coord of the bottom side
colorThe color to draw the rectangle in
angleThe angle to draw the rectangle at. Default = 0f

Updated