Click or drag to resize
AB4D logo

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
SystemObject
  Ab3d.DirectXDXResourceBase
    Ab3d.DirectXDisposableDXResource
      Ab3d.DirectXDXSceneResource
        Ab3d.DirectXSpriteBatch

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.1.9105.2048 (1.0.0.0)
Syntax
C#
public class SpriteBatch : DXSceneResource

The SpriteBatch type exposes the following members.

Properties
 NameDescription
Public propertySpritesCount Gets the number of sprites (draw calls) defined in this SpriteBatch.
Public propertyUseDeviceIndependentUnits 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.
Top
Methods
 NameDescription
Public methodBegin(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.
Public methodBegin(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.
Public methodDraw(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.
Public methodDraw(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.
Public methodDraw(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.
Public methodEnd End method ends adding sprites.
Public methodSetBlendState Sets the BlendState that will be drawn after this method is called
Public methodSetDepthStencilState Sets the DepthStencilState that will be drawn after this method is called
Public methodSetRasterizerState Sets the RasterizerState that will be drawn after this method is called
Public methodSetSamplerState Sets the SamplerState that will be drawn after this method is called
Public methodSetTransform(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).
Public methodSetTransform(Matrix) Sets the transformation of the sprites that will be drawn after this method is called
Top
See Also