DirectX SDK |
This section demonstrates how the Direct3DX utility library can help you to draw a simple sprite
The following code fragment draws a simple sprite:
hr = ::D3DXDrawSpriteSimple( m_ptex, // texture m_pd3dDevice, // 3-D device &pointDest, // destination point (center) (float)m_dwAlpha/255.0f, // alpha m_fScaleCurrent, // scale m_fRotationCurrent, // rotation NULL, // offset &srcRect // src sub rect );
The preceding code fragment shows how to draw a sprite with the D3DXDrawSpriteSimple function. This function supports scaling, rotation, alpha blending, mirroring, and placement. For a broader range of effects such as shearing and perspective, use the D3DXDrawSpriteTransform function.