Microsoft DirectX 8.1 (C++) |
Draws a simple sprite in screen-space.
HRESULT Draw( LPDIRECT3DTEXTURE8 pSrcTexture, CONST RECT* pSrcRect, CONST D3DXVECTOR2* pScaling, CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, CONST D3DVECTOR2* pTranslation, D3DCOLOR Color );
Before transformation, the size of the sprite is defined by pSrcRect with the top-left corner at the origin (0,0).
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value can be D3DERR_INVALIDCALL.
This method must be called between an IDirect3DDevice8::BeginScene and IDirect3DDevice8::EndScene pair.
If ID3DXSprite::Begin has not been called, this method will internally call Begin and ID3DXSprite::End. When making successive calls to ID3DXSprite::Draw and/or ID3DXSprite::DrawTransform, be sure to call Begin to avoid the extra overhead of Draw and DrawTransform internally calling Begin and End each time.
The image can be mirrored by specifying a negative vector in the appropriate direction (x, y, or both) for the pScaling parameter and adding the width and/or height of the source rectangle, specified in the pSrcRect parameter, to the values specified in the pTranslation parameter. Note that this will change the point of origin for rotations.
Header: Declared in D3dx8core.h.
Import Library: Use D3dx8.lib.