Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Paradox.Graphics.SpriteBatch Class Reference

Renders a group of sprites. More...

Inheritance diagram for SiliconStudio.Paradox.Graphics.SpriteBatch:
SiliconStudio.Paradox.Graphics.BatchBase< TDrawInfo > SiliconStudio.Core.ComponentBase SiliconStudio.Core.IComponent SiliconStudio.Core.ICollectorHolder SiliconStudio.Core.IReferencable SiliconStudio.Core.IReferencable

Classes

struct  SpriteDrawInfo
 

Public Member Functions

 SpriteBatch (GraphicsDevice graphicsDevice, int bufferElementCount=1024, int batchCapacity=64)
 Initializes a new instance of the SpriteBatch class. More...
 
void Begin (SpriteSortMode sortMode, Effect effect)
 Begins a sprite batch operation using deferred sort and default state objects (BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise). More...
 
void Begin (SpriteSortMode sortMode=SpriteSortMode.Deferred, BlendState blendState=null, SamplerState samplerState=null, DepthStencilState depthStencilState=null, RasterizerState rasterizerState=null, Effect effect=null, int stencilValue=0)
 Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil and rasterizer state objects, plus a custom effect. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader. More...
 
void Begin (Matrix viewMatrix, SpriteSortMode sortMode=SpriteSortMode.Deferred, BlendState blendState=null, SamplerState samplerState=null, DepthStencilState depthStencilState=null, RasterizerState rasterizerState=null, Effect effect=null, int stencilValue=0)
 Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects, plus a custom effect and a 2D transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader. More...
 
void Begin (Matrix viewMatrix, Matrix projectionMatrix, SpriteSortMode sortMode=SpriteSortMode.Deferred, BlendState blendState=null, SamplerState samplerState=null, DepthStencilState depthStencilState=null, RasterizerState rasterizerState=null, Effect effect=null, int stencilValue=0)
 Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects, plus a custom effect and a 2D transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader. More...
 
void Draw (Texture texture, RectangleF destinationRectangle, Color color)
 Adds a sprite to a batch of sprites for rendering using the specified texture, destination rectangle, and color. More...
 
void Draw (Texture texture, Vector2 position)
 Adds a sprite to a batch of sprites for rendering using the specified texture, position and color. More...
 
void Draw (Texture texture, Vector2 position, Color color)
 Adds a sprite to a batch of sprites for rendering using the specified texture, position and color. More...
 
void Draw (Texture texture, RectangleF destinationRectangle, RectangleF?sourceRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects=SpriteEffects.None, ImageOrientation orientation=ImageOrientation.AsIs, float layerDepth=0f)
 Adds a sprite to a batch of sprites for rendering using the specified texture, destination rectangle, source rectangle, color, rotation, origin, effects and layer. More...
 
void Draw (Texture texture, Vector2 position, Color color, float rotation, Vector2 origin, float scale=1.0f, SpriteEffects effects=SpriteEffects.None, ImageOrientation orientation=ImageOrientation.AsIs, float layerDepth=0)
 Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer. More...
 
void Draw (Texture texture, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects=SpriteEffects.None, ImageOrientation orientation=ImageOrientation.AsIs, float layerDepth=0)
 Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer. More...
 
void Draw (Texture texture, Vector2 position, RectangleF?sourceRectangle, Color color)
 Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, and color. More...
 
void Draw (Texture texture, Vector2 position, RectangleF?sourceRectangle, Color color, float rotation, Vector2 origin, float scale=1f, SpriteEffects effects=SpriteEffects.None, ImageOrientation orientation=ImageOrientation.AsIs, float layerDepth=0)
 Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer. More...
 
void Draw (Texture texture, Vector2 position, RectangleF?sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects=SpriteEffects.None, ImageOrientation orientation=ImageOrientation.AsIs, float layerDepth=0)
 Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer. More...
 
Vector2 MeasureString (SpriteFont spriteFont, string text, Vector2 targetSize)
 Returns the size of the given text in virtual pixels. More...
 
Vector2 MeasureString (SpriteFont spriteFont, string text, float fontSize, Vector2 targetSize)
 Returns the size of the given text in virtual pixels. More...
 
void DrawString (SpriteFont spriteFont, string text, Vector2 position, Color color, TextAlignment alignment=TextAlignment.Left)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, and color. More...
 
void DrawString (SpriteFont spriteFont, StringBuilder text, Vector2 position, Color color, TextAlignment alignment=TextAlignment.Left)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, and color. More...
 
void DrawString (SpriteFont spriteFont, string text, float fontSize, Vector2 position, Color color, TextAlignment alignment=TextAlignment.Left)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, and color. More...
 
void DrawString (SpriteFont spriteFont, StringBuilder text, float fontSize, Vector2 position, Color color, TextAlignment alignment=TextAlignment.Left)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, and color. More...
 
void DrawString (SpriteFont spriteFont, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, TextAlignment alignment)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer. More...
 
void DrawString (SpriteFont spriteFont, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, TextAlignment alignment)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer. More...
 
void DrawString (SpriteFont spriteFont, string text, float fontSize, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, TextAlignment alignment)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer. More...
 
void DrawString (SpriteFont spriteFont, StringBuilder text, float fontSize, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, TextAlignment alignment)
 Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer. More...
 
- Public Member Functions inherited from SiliconStudio.Paradox.Graphics.BatchBase< TDrawInfo >
void End ()
 Flushes the sprite batch and restores the device state to how it was before Begin was called. More...
 
- Public Member Functions inherited from SiliconStudio.Core.ComponentBase
void Dispose ()
 
override string ToString ()
 

Static Public Member Functions

static Matrix CalculateDefaultProjection (Vector3 virtualResolution)
 Calculate the default projection matrix for the provided virtual resolution. More...
 
static void CalculateDefaultProjection (ref Vector3 virtualResolution, out Matrix projection)
 Calculate the default projection matrix for the provided virtual resolution. More...
 

Protected Member Functions

override unsafe void UpdateBufferValuesFromElementInfo (ref ElementInfo elementInfo, IntPtr vertexPtr, IntPtr indexPtr, int vertexOffset)
 Update the mapped vertex and index buffer values using the provided element info. More...
 
override void PrepareForRendering ()
 
- Protected Member Functions inherited from SiliconStudio.Paradox.Graphics.BatchBase< TDrawInfo >
 BatchBase (GraphicsDevice device, Shaders.EffectBytecode defaultEffectByteCode, ResourceBufferInfo resourceBufferInfo, VertexDeclaration vertexDeclaration, int indexSize=sizeof(short))
 
void Begin (Effect effect, SpriteSortMode sessionSortMode, BlendState sessionBlendState, SamplerState sessionSamplerState, DepthStencilState sessionDepthStencilState, RasterizerState sessionRasterizerState, int stencilValue)
 Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects and a custom effect. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, depthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default effect shader. More...
 
void CheckBeginHasBeenCalled (string functionName)
 
void CheckEndHasBeenCalled (string functionName)
 
void Draw (Texture texture, Texture texture1, ref ElementInfo elementInfo)
 
- Protected Member Functions inherited from SiliconStudio.Core.ComponentBase
 ComponentBase ()
 Initializes a new instance of the ComponentBase class. More...
 
 ComponentBase (string name)
 Initializes a new instance of the ComponentBase class. More...
 
virtual void OnNameChanged ()
 Called when Name property was changed. More...
 
virtual void Destroy ()
 Disposes of object resources. More...
 

Properties

float DefaultDepth [get, set]
 Gets or sets the default depth value used by the SpriteBatch when the VirtualResolution is not set. More...
 
Vector3 VirtualResolution [get, set]
 Gets or sets the virtual resolution used for this SpriteBatch More...
 
- Properties inherited from SiliconStudio.Paradox.Graphics.BatchBase< TDrawInfo >
Effect Effect [get, set]
 The effect used for the current Begin/End session. More...
 
TextureIdComparer TextureComparer [get, set]
 
QueueComparer< ElementInfo > BackToFrontComparer [get, set]
 
QueueComparer< ElementInfo > FrontToBackComparer [get, set]
 
- Properties inherited from SiliconStudio.Core.ComponentBase
long Id [get, set]
 
string Name [get, set]
 Gets or sets the name of this component. More...
 
bool IsDisposed [get, set]
 Has the component been disposed or not yet. More...
 
- Properties inherited from SiliconStudio.Core.IComponent
long Id [get]
 Gets the id of this component. More...
 
string Name [get]
 Gets the name of this component. More...
 
- Properties inherited from SiliconStudio.Core.IReferencable
int ReferenceCount [get]
 Gets the reference count of this instance. More...
 
- Properties inherited from SiliconStudio.Core.ICollectorHolder
ObjectCollector Collector [get]
 Gets the collector. More...
 

Additional Inherited Members

- Public Attributes inherited from SiliconStudio.Core.ComponentBase
PropertyContainer Tags
 Gets the attached properties to this component. More...
 
- Protected Attributes inherited from SiliconStudio.Paradox.Graphics.BatchBase< TDrawInfo >
readonly DeviceResourceContext ResourceContext
 
GraphicsDevice GraphicsDevice
 
BlendState BlendState
 
RasterizerState RasterizerState
 
SamplerState SamplerState
 
DepthStencilState DepthStencilState
 
int StencilReferenceValue
 
SpriteSortMode SortMode
 
readonly Effect DefaultEffect
 

Detailed Description

Renders a group of sprites.

Definition at line 8 of file SpriteBatch.Extensions.cs.

Constructor & Destructor Documentation

SiliconStudio.Paradox.Graphics.SpriteBatch.SpriteBatch ( GraphicsDevice  graphicsDevice,
int  bufferElementCount = 1024,
int  batchCapacity = 64 
)

Initializes a new instance of the SpriteBatch class.

Parameters
graphicsDeviceThe graphics device.
bufferElementCountThe maximum number element that can be batched in one time.
batchCapacityThe batch capacity default to 64.

Definition at line 44 of file SpriteBatch.cs.

Member Function Documentation

void SiliconStudio.Paradox.Graphics.SpriteBatch.Begin ( SpriteSortMode  sortMode,
Effect  effect 
)

Begins a sprite batch operation using deferred sort and default state objects (BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise).

Parameters
sortModeThe sprite drawing order to use for the batch session
effectThe effect to use for the batch session

Definition at line 93 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Begin ( SpriteSortMode  sortMode = SpriteSortMode.Deferred,
BlendState  blendState = null,
SamplerState  samplerState = null,
DepthStencilState  depthStencilState = null,
RasterizerState  rasterizerState = null,
Effect  effect = null,
int  stencilValue = 0 
)

Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil and rasterizer state objects, plus a custom effect. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader.

Parameters
sortModeThe sprite drawing order to use for the batch session
effectThe effect to use for the batch session
blendStateThe blending state to use for the batch session
samplerStateThe sampling state to use for the batch session
depthStencilStateThe depth stencil state to use for the batch session
rasterizerStateThe rasterizer state to use for the batch session
stencilValueThe value of the stencil buffer to take as reference for the batch session

Definition at line 109 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Begin ( Matrix  viewMatrix,
SpriteSortMode  sortMode = SpriteSortMode.Deferred,
BlendState  blendState = null,
SamplerState  samplerState = null,
DepthStencilState  depthStencilState = null,
RasterizerState  rasterizerState = null,
Effect  effect = null,
int  stencilValue = 0 
)

Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects, plus a custom effect and a 2D transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader.

Parameters
sortModeThe sprite drawing order to use for the batch session
effectThe effect to use for the batch session
blendStateThe blending state to use for the batch session
samplerStateThe sampling state to use for the batch session
depthStencilStateThe depth stencil state to use for the batch session
rasterizerStateThe rasterizer state to use for the batch session
stencilValueThe value of the stencil buffer to take as reference for the batch session
viewMatrixThe view matrix to use for the batch session

Definition at line 126 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Begin ( Matrix  viewMatrix,
Matrix  projectionMatrix,
SpriteSortMode  sortMode = SpriteSortMode.Deferred,
BlendState  blendState = null,
SamplerState  samplerState = null,
DepthStencilState  depthStencilState = null,
RasterizerState  rasterizerState = null,
Effect  effect = null,
int  stencilValue = 0 
)

Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects, plus a custom effect and a 2D transformation matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader.

Parameters
sortModeThe sprite drawing order to use for the batch session
effectThe effect to use for the batch session
blendStateThe blending state to use for the batch session
samplerStateThe sampling state to use for the batch session
depthStencilStateThe depth stencil state to use for the batch session
rasterizerStateThe rasterizer state to use for the batch session
stencilValueThe value of the stencil buffer to take as reference for the batch session
viewMatrixThe view matrix to use for the batch session
projectionMatrixThe projection matrix to use for the batch session

Definition at line 144 of file SpriteBatch.cs.

static Matrix SiliconStudio.Paradox.Graphics.SpriteBatch.CalculateDefaultProjection ( Vector3  virtualResolution)
static

Calculate the default projection matrix for the provided virtual resolution.

Returns
The default projection matrix for the provided virtual resolution

The sprite batch default projection is an orthogonal matrix such as (0,0) is the Top/Left corner of the screen and (VirtualResolution.X, VirtualResolution.Y) is the Bottom/Right corner of the screen.

Definition at line 56 of file SpriteBatch.cs.

static void SiliconStudio.Paradox.Graphics.SpriteBatch.CalculateDefaultProjection ( ref Vector3  virtualResolution,
out Matrix  projection 
)
static

Calculate the default projection matrix for the provided virtual resolution.

Definition at line 68 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
RectangleF  destinationRectangle,
Color  color 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, destination rectangle, and color.

Parameters
textureA texture.
destinationRectangleA rectangle that specifies (in screen coordinates) the destination for drawing the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.

Before making any calls to Draw, you must call Begin. Once all calls to Draw are complete, call End.

Definition at line 163 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
Vector2  position 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, position and color.

Parameters
textureA texture.
positionThe location (in screen coordinates) to draw the sprite.

Definition at line 173 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Color.White.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
Vector2  position,
Color  color 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, position and color.

Parameters
textureA texture.
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.

Definition at line 184 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.X, and SiliconStudio.Core.Mathematics.Vector2.Y.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
RectangleF  destinationRectangle,
RectangleF sourceRectangle,
Color  color,
float  rotation,
Vector2  origin,
SpriteEffects  effects = SpriteEffects.None,
ImageOrientation  orientation = ImageOrientation.AsIs,
float  layerDepth = 0f 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, destination rectangle, source rectangle, color, rotation, origin, effects and layer.

Parameters
textureA texture.
orientationThe source image orientation
destinationRectangleA rectangle that specifies (in screen coordinates) the destination for drawing the sprite. If this rectangle is not the same size as the source rectangle, the sprite will be scaled to fit.
sourceRectangleA rectangle that specifies (in texels) the source texels from a texture. Use null to draw the entire texture.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in the texture in pixels (dependent of image orientation). Default value is (0,0) which represents the upper-left corner.
effectsEffects to apply.
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.

Definition at line 202 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
Vector2  position,
Color  color,
float  rotation,
Vector2  origin,
float  scale = 1.0f,
SpriteEffects  effects = SpriteEffects.None,
ImageOrientation  orientation = ImageOrientation.AsIs,
float  layerDepth = 0 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer.

Parameters
textureA texture.
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in the texture in pixels (dependent of image orientation). Default value is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
orientationThe source image orientation
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.

Definition at line 221 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
Vector2  position,
Color  color,
float  rotation,
Vector2  origin,
Vector2  scale,
SpriteEffects  effects = SpriteEffects.None,
ImageOrientation  orientation = ImageOrientation.AsIs,
float  layerDepth = 0 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer.

Parameters
textureA texture.
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in the texture in pixels (dependent of image orientation). Default value is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
orientationThe source image orientation
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.

Definition at line 239 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
Vector2  position,
RectangleF sourceRectangle,
Color  color 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, and color.

Parameters
textureA texture.
positionThe location (in screen coordinates) to draw the sprite.
sourceRectangleA rectangle that specifies (in texels) the source texels from a texture. Use null to draw the entire texture.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.

Definition at line 252 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.X, and SiliconStudio.Core.Mathematics.Vector2.Y.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
Vector2  position,
RectangleF sourceRectangle,
Color  color,
float  rotation,
Vector2  origin,
float  scale = 1f,
SpriteEffects  effects = SpriteEffects.None,
ImageOrientation  orientation = ImageOrientation.AsIs,
float  layerDepth = 0 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer.

Parameters
textureA texture.
positionThe location (in screen coordinates) to draw the sprite.
sourceRectangleA rectangle that specifies (in texels) the source texels from a texture. Use null to draw the entire texture.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in the texture in pixels (dependent of image orientation). Default value is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
orientationThe source image orientation
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.

Definition at line 271 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.X, and SiliconStudio.Core.Mathematics.Vector2.Y.

void SiliconStudio.Paradox.Graphics.SpriteBatch.Draw ( Texture  texture,
Vector2  position,
RectangleF sourceRectangle,
Color  color,
float  rotation,
Vector2  origin,
Vector2  scale,
SpriteEffects  effects = SpriteEffects.None,
ImageOrientation  orientation = ImageOrientation.AsIs,
float  layerDepth = 0 
)

Adds a sprite to a batch of sprites for rendering using the specified texture, position, source rectangle, color, rotation, origin, scale, effects, and layer.

Parameters
textureA texture.
positionThe location (in screen coordinates) to draw the sprite.
sourceRectangleA rectangle that specifies (in texels) the source texels from a texture. Use null to draw the entire texture.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in the texture in pixels (dependent of image orientation). Default value is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
orientationThe source image orientation
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.

Definition at line 291 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.X, and SiliconStudio.Core.Mathematics.Vector2.Y.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
string  text,
Vector2  position,
Color  color,
TextAlignment  alignment = TextAlignment.Left 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, and color.

Parameters
spriteFontA font for displaying text.
textA text string.
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
alignmentDescribes how to align the text to draw

Definition at line 349 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.One, and SiliconStudio.Core.Mathematics.Vector2.Zero.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
StringBuilder  text,
Vector2  position,
Color  color,
TextAlignment  alignment = TextAlignment.Left 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, and color.

Parameters
spriteFontA font for displaying text.
textText string.
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
alignmentDescribes how to align the text to draw

Definition at line 361 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.One, and SiliconStudio.Core.Mathematics.Vector2.Zero.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
string  text,
float  fontSize,
Vector2  position,
Color  color,
TextAlignment  alignment = TextAlignment.Left 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, and color.

Parameters
spriteFontA font for displaying text.
textA text string.
fontSizeThe font size in pixels (ignored in the case of static fonts)
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
alignmentDescribes how to align the text to draw

Definition at line 374 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.One, and SiliconStudio.Core.Mathematics.Vector2.Zero.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
StringBuilder  text,
float  fontSize,
Vector2  position,
Color  color,
TextAlignment  alignment = TextAlignment.Left 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, and color.

Parameters
spriteFontA font for displaying text.
textText string.
fontSizeThe font size in pixels (ignored in the case of static fonts)
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
alignmentDescribes how to align the text to draw

Definition at line 387 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.One, and SiliconStudio.Core.Mathematics.Vector2.Zero.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
string  text,
Vector2  position,
Color  color,
float  rotation,
Vector2  origin,
Vector2  scale,
SpriteEffects  effects,
float  layerDepth,
TextAlignment  alignment 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer.

Parameters
spriteFontA font for displaying text.
textA text string.
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in virtual pixels; the default is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.
alignmentDescribes how to align the text to draw

Definition at line 404 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
StringBuilder  text,
Vector2  position,
Color  color,
float  rotation,
Vector2  origin,
Vector2  scale,
SpriteEffects  effects,
float  layerDepth,
TextAlignment  alignment 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer.

Parameters
spriteFontA font for displaying text.
textText string.
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in virtual pixels; the default is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.
alignmentDescribes how to align the text to draw

Definition at line 421 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
string  text,
float  fontSize,
Vector2  position,
Color  color,
float  rotation,
Vector2  origin,
Vector2  scale,
SpriteEffects  effects,
float  layerDepth,
TextAlignment  alignment 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer.

Parameters
spriteFontA font for displaying text.
textA text string.
fontSizeThe font size in pixels (ignored in the case of static fonts)
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in virtual pixels; the default is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.
alignmentDescribes how to align the text to draw

Definition at line 439 of file SpriteBatch.cs.

void SiliconStudio.Paradox.Graphics.SpriteBatch.DrawString ( SpriteFont  spriteFont,
StringBuilder  text,
float  fontSize,
Vector2  position,
Color  color,
float  rotation,
Vector2  origin,
Vector2  scale,
SpriteEffects  effects,
float  layerDepth,
TextAlignment  alignment 
)

Adds a string to a batch of sprites for rendering using the specified font, text, position, color, rotation, origin, scale, effects and layer.

Parameters
spriteFontA font for displaying text.
textText string.
fontSizeThe font size in pixels (ignored in the case of static fonts)
positionThe location (in screen coordinates) to draw the sprite.
colorThe color to tint a sprite. Use Color.White for full color with no tinting.
rotationSpecifies the angle (in radians) to rotate the sprite about its center.
originThe sprite origin in virtual pixels; the default is (0,0) which represents the upper-left corner.
scaleScale factor.
effectsEffects to apply.
layerDepthThe depth of a layer. By default, 0 represents the front layer and 1 represents a back layer. Use SpriteSortMode if you want sprites to be sorted during drawing.
alignmentDescribes how to align the text to draw

Definition at line 457 of file SpriteBatch.cs.

Vector2 SiliconStudio.Paradox.Graphics.SpriteBatch.MeasureString ( SpriteFont  spriteFont,
string  text,
Vector2  targetSize 
)

Returns the size of the given text in virtual pixels.

Parameters
spriteFontThe font used to draw the text.
textThe text to measure.
targetSizeThe size of the target to render in
Returns
The size of the text in virtual pixels.
Exceptions
ArgumentNullExceptionThe provided sprite font is null.

Definition at line 306 of file SpriteBatch.cs.

References SiliconStudio.Paradox.Graphics.SpriteFont.Size.

Vector2 SiliconStudio.Paradox.Graphics.SpriteBatch.MeasureString ( SpriteFont  spriteFont,
string  text,
float  fontSize,
Vector2  targetSize 
)

Returns the size of the given text in virtual pixels.

Parameters
spriteFontThe font used to draw the text.
textThe text to measure.
targetSizeThe size of the target to render in
fontSizeThe font size (in pixels) used to draw the text.
Returns
The size of the text in virtual pixels.
Exceptions
ArgumentNullExceptionThe provided sprite font is null.

Definition at line 322 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.Vector2.X, and SiliconStudio.Core.Mathematics.Vector2.Y.

override void SiliconStudio.Paradox.Graphics.SpriteBatch.PrepareForRendering ( )
protectedvirtual

Reimplemented from SiliconStudio.Paradox.Graphics.BatchBase< TDrawInfo >.

Definition at line 616 of file SpriteBatch.cs.

override unsafe void SiliconStudio.Paradox.Graphics.SpriteBatch.UpdateBufferValuesFromElementInfo ( ref ElementInfo  elementInfo,
IntPtr  vertexPointer,
IntPtr  indexPointer,
int  vexterStartOffset 
)
protectedvirtual

Update the mapped vertex and index buffer values using the provided element info.

Parameters
elementInfoThe structure containing the information about the element to draw.
vertexPointerThe pointer to the vertex array buffer to update.
indexPointerThe pointer to the index array buffer to update. This value is null if the index buffer used is static.
vexterStartOffsetThe offset in the vertex buffer where the vertex of the element starts

Implements SiliconStudio.Paradox.Graphics.BatchBase< TDrawInfo >.

Definition at line 576 of file SpriteBatch.cs.

References SiliconStudio.Core.Mathematics.MathUtil.ZeroTolerance.

Property Documentation

float SiliconStudio.Paradox.Graphics.SpriteBatch.DefaultDepth
getset

Gets or sets the default depth value used by the SpriteBatch when the VirtualResolution is not set.

More precisely, this value represents the length "farPlane-nearPlane" used by the default projection matrix.

Definition at line 31 of file SpriteBatch.cs.

Vector3 SiliconStudio.Paradox.Graphics.SpriteBatch.VirtualResolution
getset

Gets or sets the virtual resolution used for this SpriteBatch

Definition at line 36 of file SpriteBatch.cs.


The documentation for this class was generated from the following files: