C# Class Microsoft.Xna.Framework.Graphics.SpriteBatch

Inheritance: GraphicsResource
Exibir arquivo Open project: procfxgen/MGShaderEditor Class Usage Examples

Public Methods

Method Description
Begin ( SpriteSortMode sortMode = SpriteSortMode.Deferred, BlendState blendState = null, SamplerState samplerState = null, DepthStencilState depthStencilState = null, RasterizerState rasterizerState = null, Effect effect = null, System.Matrix transformMatrix = null ) : void

Begins a new sprite and text batch with the specified render state.

This method uses optional parameters.The Begin Begin should be called before drawing commands, and you cannot call it again before subsequent End.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, System.Color color ) : void

Submit a sprite for drawing in the current batch.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, System.Color color ) : void

Submit a sprite for drawing in the current batch.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, SpriteEffects effects, float layerDepth ) : void

Submit a sprite for drawing in the current batch.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, System.Color color ) : void

Submit a sprite for drawing in the current batch.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color ) : void

Submit a sprite for drawing in the current batch.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, System.Vector2 scale, SpriteEffects effects, float layerDepth ) : void

Submit a sprite for drawing in the current batch.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void

Submit a sprite for drawing in the current batch.

Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position = null, Rectangle destinationRectangle = null, Rectangle sourceRectangle = null, System.Vector2 origin = null, float rotation = 0f, System.Vector2 scale = null, System.Color color = null, SpriteEffects effects = SpriteEffects.None, float layerDepth = 0f ) : void

Submit a sprite for drawing in the current batch.

This overload uses optional parameters. This overload requires only one of position and destinationRectangle been used.

DrawString ( SpriteFont spriteFont, StringBuilder text, System.Vector2 position, System.Color color ) : void

Submit a text string of sprites for drawing in the current batch.

DrawString ( SpriteFont spriteFont, StringBuilder text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, System.Vector2 scale, SpriteEffects effects, float layerDepth ) : void

Submit a text string of sprites for drawing in the current batch.

DrawString ( SpriteFont spriteFont, StringBuilder text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void

Submit a text string of sprites for drawing in the current batch.

DrawString ( SpriteFont spriteFont, string text, System.Vector2 position, System.Color color ) : void

Submit a text string of sprites for drawing in the current batch.

DrawString ( SpriteFont spriteFont, string text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, System.Vector2 scale, SpriteEffects effects, float layerDepth ) : void

Submit a text string of sprites for drawing in the current batch.

DrawString ( SpriteFont spriteFont, string text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void

Submit a text string of sprites for drawing in the current batch.

End ( ) : void

Flushes all batched text and sprites to the screen.

This command should be called after Begin and drawing commands.

SpriteBatch ( Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice ) : System

Constructs a SpriteBatch.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Immediately releases the unmanaged resources used by this object.

Private Methods

Method Description
CheckValid ( SpriteFont spriteFont, StringBuilder text ) : void
CheckValid ( SpriteFont spriteFont, string text ) : void
CheckValid ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : void
DrawInternal ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector4 destinationRectangle, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, SpriteEffects effect, float depth, bool autoFlush ) : void
FlushIfNeeded ( ) : void
Setup ( ) : void

Method Details

Begin() public method

Begins a new sprite and text batch with the specified render state.
This method uses optional parameters. The Begin Begin should be called before drawing commands, and you cannot call it again before subsequent End.
Thrown if is called next time without previous .
public Begin ( SpriteSortMode sortMode = SpriteSortMode.Deferred, BlendState blendState = null, SamplerState samplerState = null, DepthStencilState depthStencilState = null, RasterizerState rasterizerState = null, Effect effect = null, System.Matrix transformMatrix = null ) : void
sortMode SpriteSortMode The drawing order for sprite and text drawing. by default.
blendState BlendState State of the blending. Uses if null.
samplerState SamplerState State of the sampler. Uses if null.
depthStencilState DepthStencilState State of the depth-stencil buffer. Uses if null.
rasterizerState RasterizerState State of the rasterization. Uses if null.
effect Effect A custom to override the default sprite effect. Uses default sprite effect if null.
transformMatrix System.Matrix An optional matrix used to transform the sprite geometry. Uses if null.
return void

Dispose() protected method

Immediately releases the unmanaged resources used by this object.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, System.Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
destinationRectangle Rectangle The drawing bounds on screen.
color System.Color A color mask.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, System.Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
destinationRectangle Rectangle The drawing bounds on screen.
sourceRectangle Rectangle An optional region on the texture which will be rendered. If null - draws full texture.
color System.Color A color mask.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, SpriteEffects effects, float layerDepth ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
destinationRectangle Rectangle The drawing bounds on screen.
sourceRectangle Rectangle An optional region on the texture which will be rendered. If null - draws full texture.
color System.Color A color mask.
rotation float A rotation of this sprite.
origin System.Vector2 Center of the rotation. 0,0 by default.
effects SpriteEffects Modificators for drawing. Can be combined.
layerDepth float A depth of the layer of this sprite.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, System.Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
position System.Vector2 The drawing location on screen.
color System.Color A color mask.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
position System.Vector2 The drawing location on screen.
sourceRectangle Rectangle An optional region on the texture which will be rendered. If null - draws full texture.
color System.Color A color mask.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, System.Vector2 scale, SpriteEffects effects, float layerDepth ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
position System.Vector2 The drawing location on screen.
sourceRectangle Rectangle An optional region on the texture which will be rendered. If null - draws full texture.
color System.Color A color mask.
rotation float A rotation of this sprite.
origin System.Vector2 Center of the rotation. 0,0 by default.
scale System.Vector2 A scaling of this sprite.
effects SpriteEffects Modificators for drawing. Can be combined.
layerDepth float A depth of the layer of this sprite.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
position System.Vector2 The drawing location on screen.
sourceRectangle Rectangle An optional region on the texture which will be rendered. If null - draws full texture.
color System.Color A color mask.
rotation float A rotation of this sprite.
origin System.Vector2 Center of the rotation. 0,0 by default.
scale float A scaling of this sprite.
effects SpriteEffects Modificators for drawing. Can be combined.
layerDepth float A depth of the layer of this sprite.
return void

Draw() public method

Submit a sprite for drawing in the current batch.
This overload uses optional parameters. This overload requires only one of position and destinationRectangle been used.
Throwns if both and been used.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position = null, Rectangle destinationRectangle = null, Rectangle sourceRectangle = null, System.Vector2 origin = null, float rotation = 0f, System.Vector2 scale = null, System.Color color = null, SpriteEffects effects = SpriteEffects.None, float layerDepth = 0f ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
position System.Vector2 The drawing location on screen or null if is used.
destinationRectangle Rectangle The drawing bounds on screen or null if is used.
sourceRectangle Rectangle An optional region on the texture which will be rendered. If null - draws full texture.
origin System.Vector2 An optional center of rotation. Uses if null.
rotation float An optional rotation of this sprite. 0 by default.
scale System.Vector2 An optional scale vector. Uses if null.
color System.Color An optional color mask. Uses if null.
effects SpriteEffects The optional drawing modificators. by default.
layerDepth float An optional depth of the layer of this sprite. 0 by default.
return void

DrawString() public method

Submit a text string of sprites for drawing in the current batch.
public DrawString ( SpriteFont spriteFont, StringBuilder text, System.Vector2 position, System.Color color ) : void
spriteFont SpriteFont A font.
text StringBuilder The text which will be drawn.
position System.Vector2 The drawing location on screen.
color System.Color A color mask.
return void

DrawString() public method

Submit a text string of sprites for drawing in the current batch.
public DrawString ( SpriteFont spriteFont, StringBuilder text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, System.Vector2 scale, SpriteEffects effects, float layerDepth ) : void
spriteFont SpriteFont A font.
text StringBuilder The text which will be drawn.
position System.Vector2 The drawing location on screen.
color System.Color A color mask.
rotation float A rotation of this string.
origin System.Vector2 Center of the rotation. 0,0 by default.
scale System.Vector2 A scaling of this string.
effects SpriteEffects Modificators for drawing. Can be combined.
layerDepth float A depth of the layer of this string.
return void

DrawString() public method

Submit a text string of sprites for drawing in the current batch.
public DrawString ( SpriteFont spriteFont, StringBuilder text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void
spriteFont SpriteFont A font.
text StringBuilder The text which will be drawn.
position System.Vector2 The drawing location on screen.
color System.Color A color mask.
rotation float A rotation of this string.
origin System.Vector2 Center of the rotation. 0,0 by default.
scale float A scaling of this string.
effects SpriteEffects Modificators for drawing. Can be combined.
layerDepth float A depth of the layer of this string.
return void

DrawString() public method

Submit a text string of sprites for drawing in the current batch.
public DrawString ( SpriteFont spriteFont, string text, System.Vector2 position, System.Color color ) : void
spriteFont SpriteFont A font.
text string The text which will be drawn.
position System.Vector2 The drawing location on screen.
color System.Color A color mask.
return void

DrawString() public method

Submit a text string of sprites for drawing in the current batch.
public DrawString ( SpriteFont spriteFont, string text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, System.Vector2 scale, SpriteEffects effects, float layerDepth ) : void
spriteFont SpriteFont A font.
text string The text which will be drawn.
position System.Vector2 The drawing location on screen.
color System.Color A color mask.
rotation float A rotation of this string.
origin System.Vector2 Center of the rotation. 0,0 by default.
scale System.Vector2 A scaling of this string.
effects SpriteEffects Modificators for drawing. Can be combined.
layerDepth float A depth of the layer of this string.
return void

DrawString() public method

Submit a text string of sprites for drawing in the current batch.
public DrawString ( SpriteFont spriteFont, string text, System.Vector2 position, System.Color color, float rotation, System.Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void
spriteFont SpriteFont A font.
text string The text which will be drawn.
position System.Vector2 The drawing location on screen.
color System.Color A color mask.
rotation float A rotation of this string.
origin System.Vector2 Center of the rotation. 0,0 by default.
scale float A scaling of this string.
effects SpriteEffects Modificators for drawing. Can be combined.
layerDepth float A depth of the layer of this string.
return void

End() public method

Flushes all batched text and sprites to the screen.
This command should be called after Begin and drawing commands.
public End ( ) : void
return void

SpriteBatch() public method

Constructs a SpriteBatch.
Thrown when is null.
public SpriteBatch ( Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice ) : System
graphicsDevice Microsoft.Xna.Framework.Graphics.GraphicsDevice The , which will be used for sprite rendering.
return System