
114 5. Sprites and Animation
5.3.3 Loading the Texture
e texture that is applied to a sprite will typically be located in a le. We need a function
to load the texture image from the le. e DirectX function we will use for this task is
D3DXCreateTextureFromFileEx. Here is the formal syntax:
HRESULT D3DXCreateTextureFromFileEx(
LPDIRECT3DDEVICE9 pDevice,
LPCTSTR pSrcFile,
UINT Width,
UINT Height,
UINT MipLevels,
DWORD Usage,
D3DFORMAT Format,
D3DPOOL Pool,
DWORD Filter,
DWORD MipFilter,
D3DCOLOR ColorKey,
D3DXIMAGE_INFO *pSrcInfo,
PALETTEENTRY *pPalette,
LPDIRECT3DTEXTURE9 *ppTexture
);
e parameters:
• pDevice. Pointer to an IDirect3DDevice9 int ...