Platform SDK: DirectX

D3DXBuildSpriteTransform

The D3DXBuildSpriteTransform function creates a matrix that corresponds to a transformation from the -0.5 to +0.5 centered rectangle to a particular RECT structure on the screen. Additionally, an angle of rotation can be specified for that RECT structure.

void D3DXBuildSpriteTransform(
  D3DXMATRIX* pMatrixTransform,
  const RECT* prectDest,
  float angleRad = 0.0f,
  const D3DXVECTOR2* pOffset
);

Parameters

pMatrixTransform
A pointer to the result matrix, a D3DXMATRIX structure. This matrix will be returned with new values that correspond to the transformation specified by the prectDest, angleRad and pOffset parameters.
prectDest
A pointer to the target rectangle for the sprite, indicating in screen coordinates where the sprite should be located. The sprite will be stretched to fill this RECT structure
angleRad
Angle of rotation around the center of the RECT, indicating what angle to rotate the sprite. The rotation is applied around the center of the sprite. It is counter-clockwise and must be specified in radians. See D3DXToRadian to convert degrees to radians.
pOffset
A pointer to a D3DXVECTOR2 structure, defining the offset from the center of the source RECT to use as the center of rotation. This parameter indicates the offset from the center-point of the sprite that should be treated as the sprite center for the purposes of rotation. By default, a value of NULL is equivalent to a vector of (0, 0).

Return Values

None.

Remarks

The D3DXBuildSpriteTransform function is provided as a helper function to use the D3DXDrawSpriteTransform function.

Note that C programmers will not be able to take advantage of the default value for the angleRad parameter.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Version: Requires DirectX 7.0.
  Header: Declared in d3dxsprite.h.
  Library: Use d3dx.lib.