ID3DXSprite::Draw method

Adds a sprite to the list of batched sprites.

Syntax

HRESULT Draw(
  [in]       LPDIRECT3DTEXTURE9 pTexture,
  [in] const RECT               *pSrcRect,
  [in] const D3DXVECTOR3        *pCenter,
  [in] const D3DXVECTOR3        *pPosition,
  [in]       D3DCOLOR           Color
);

Parameters

pTexture [in]

Type: LPDIRECT3DTEXTURE9

Pointer to an IDirect3DTexture9 interface that represents the sprite texture.

pSrcRect [in]

Type: const RECT*

Pointer to a RECT structure that indicates the portion of the source texture to use for the sprite. If this parameter is NULL, then the entire source image is used for the sprite.

pCenter [in]

Type: const D3DXVECTOR3*

Pointer to a D3DXVECTOR3 vector that identifies the center of the sprite. If this argument is NULL, the point (0,0,0) is used, which is the upper-left corner.

pPosition [in]

Type: const D3DXVECTOR3*

Pointer to a D3DXVECTOR3 vector that identifies the position of the sprite. If this argument is NULL, the point (0,0,0) is used, which is the upper-left corner.

Color [in]

Type: D3DCOLOR

D3DCOLOR type. The color and alpha channels are modulated by this value. A value of 0xFFFFFFFF maintains the original source color and alpha data. Use the D3DCOLOR_RGBA macro to help generate this color.

Return value

Type: HRESULT

If the method succeeds, the return value is S_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA.

Remarks

To scale, rotate, or translate a sprite, call ID3DXSprite::SetTransform with a matrix that contains the scale, rotate, and translate (SRT) values, before calling ID3DXSprite::Draw. For information about setting SRT values in a matrix, see Matrix Transforms.

Requirements

Requirement Value
Header
D3dx9core.h
Library
D3dx9.lib

See also

ID3DXSprite

ID3DXSprite::GetTransform