|
SpriteBatch Class |
SpriteBatch class defines a collection of sprites (textures) that can be very quickly rendered to the 3D scene defined by
DXScene object.
Inheritance Hierarchy Namespace: Ab3d.DirectXAssembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.1.9105.2048 (1.0.0.0)
Syntax public class SpriteBatch : DXSceneResource
The SpriteBatch type exposes the following members.
Properties | Name | Description |
---|
| SpritesCount |
Gets the number of sprites (draw calls) defined in this SpriteBatch.
|
| UseDeviceIndependentUnits |
Gets or sets a Boolean that specifies if device independent units (same as in WPF) are used for absolute destination rectangle - in this case the coordinates and size are multiplied by dpi scale.
Default value is false - in this case the units are pixels.
|
TopMethods | Name | Description |
---|
| Begin(BlendState, SamplerState, DepthStencilState, RasterizerState, SpriteEffect) |
Begin method must be called before any Draw(ShaderResourceView, RectangleF, Boolean, Color4) or Draw(ShaderResourceView, RectangleF, RectangleF, Boolean, Color4) calls.
The method sets common properties of all sprites that will be defined by Draw call.
After all draw calls are done, the End method must be called.
|
| Begin(Matrix, BlendState, SamplerState, DepthStencilState, RasterizerState, SpriteEffect) |
Begin method must be called before any Draw(ShaderResourceView, RectangleF, Boolean, Color4) or Draw(ShaderResourceView, RectangleF, RectangleF, Boolean, Color4) calls.
The method sets common properties of all sprites that will be defined by Draw call.
After all draw calls are done, the End method must be called.
|
| Draw(ShaderResourceView, RectangleF, Boolean) |
Draw method adds the specified texture to the destinationRectangle and with specified mask defined by the color parameter.
Draw method must be called after Begin and End methods are called.
|
| Draw(ShaderResourceView, RectangleF, Boolean, Color4) |
Draw method adds the specified texture to the destinationRectangle and with specified mask defined by the color parameter.
Draw method must be called after Begin and End methods are called.
|
| Draw(ShaderResourceView, RectangleF, RectangleF, Boolean, Color4) |
Draw method adds the specified texture to the destinationRectangle and with specified mask defined by the color parameter.
The method takes sourceRectangle as parameter. This can be used to have one texture with many images.
Draw method must be called after Begin and End methods are called.
|
| End |
End method ends adding sprites.
|
| SetBlendState |
Sets the BlendState that will be drawn after this method is called
|
| SetDepthStencilState |
Sets the DepthStencilState that will be drawn after this method is called
|
| SetRasterizerState |
Sets the RasterizerState that will be drawn after this method is called
|
| SetSamplerState |
Sets the SamplerState that will be drawn after this method is called
|
| SetTransform(Matrix) |
Sets the transformation of the sprites that will be drawn after this method is called.
Note that the coordinate system goes from (0, 0) at top-left corner to (1, 1) at bottom right corner.
To rotate the sprite, set the destinationRectangle in the Draw command so that the center of the sprite will be at (0, 0).
|
| SetTransform(Matrix) |
Sets the transformation of the sprites that will be drawn after this method is called
|
TopSee Also