Class SpriteBatchExtensions
A set of extension methods for dealing with Microsoft.Xna.Framework.Graphics.SpriteBatch and MonoGame.Extended.RectangleF in combination.
public static class SpriteBatchExtensions
- Inheritance
-
SpriteBatchExtensions
- Inherited Members
Methods
Draw(SpriteBatch, Texture2D, RectangleF, Color)
Submit a sprite for drawing in the current batch.
public static void Draw(this SpriteBatch batch, Texture2D texture, RectangleF destinationRectangle, Color color)
Parameters
batchSpriteBatchThe sprite batch to draw with.
textureTexture2DA texture.
destinationRectangleRectangleFThe drawing bounds on screen.
colorColorA color mask.
Draw(SpriteBatch, Texture2D, RectangleF, Rectangle?, Color)
Submit a sprite for drawing in the current batch.
public static void Draw(this SpriteBatch batch, Texture2D texture, RectangleF destinationRectangle, Rectangle? sourceRectangle, Color color)
Parameters
batchSpriteBatchThe sprite batch to draw with.
textureTexture2DA texture.
destinationRectangleRectangleFThe drawing bounds on screen.
sourceRectangleRectangle?An optional region on the texture which will be rendered. If null - draws full texture.
colorColorA color mask.
Draw(SpriteBatch, Texture2D, RectangleF, Rectangle?, Color, float, Vector2, SpriteEffects, float)
Submit a sprite for drawing in the current batch.
public static void Draw(this SpriteBatch batch, Texture2D texture, RectangleF destinationRectangle, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth)
Parameters
batchSpriteBatchThe sprite batch to draw with.
textureTexture2DA texture.
destinationRectangleRectangleFThe drawing bounds on screen.
sourceRectangleRectangle?An optional region on the texture which will be rendered. If null - draws full texture.
colorColorA color mask.
rotationfloatA rotation of this sprite.
originVector2Center of the rotation. 0,0 by default.
effectsSpriteEffectsModificators for drawing. Can be combined.
layerDepthfloatA depth of the layer of this sprite.
DrawGrid(SpriteBatch, Vector2, Vector2, Point, Color, float)
Draws a grid of tile outlines reminiscent of graph paper.
public static void DrawGrid(this SpriteBatch batch, Vector2 start, Vector2 tileSize, Point tileCount, Color gridColor, float gridThickness = 1)
Parameters
batchSpriteBatchThe sprite batch to draw with
startVector2The top left coordinate of the grid
tileSizeVector2The size of each tile
tileCountPointThe amount of tiles in the x and y axes
gridColorColorThe color to draw the grid outlines in
gridThicknessfloatThe thickness of each grid line. Defaults to 1.