Archived

This topic is now archived and is closed to further replies.

last-bastardo

ID3DXSprite : Need help with this

Recommended Posts

ID3DXSprite is a class to draw "sprites" in D3D but I cannot find ANY documentation on it and I do exactly what the SDK tells me and I don''t see anything. Create a sprite load a texture and draw it and I get nothing. Please any help would be really appreciated -=Last Bastardo=-

Share this post


Link to post
Share on other sites
Here is my render loop for the sprite drawing within the DX8 SDK.
All seems to work ok with me. The sprite interface is created with:

hr = D3DXCreateSprite(pID3DDevice, &pSprite);

if(FAILED(hr))
break;

A texture is loaded and up it comes on the screen. Note that you need to set the modulation colour otherwise the texture may be "blacked out".

I can post more code if you need.

Hope this helps

herny


hr = pID3DDevice->Clear(0,
NULL,
D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
D3DCOLOR_RGBA(128,0,0,0),
1.0,
0);
if(FAILED(hr))
break;


// start drawing
hr = pID3DDevice->BeginScene();
if(FAILED(hr))
break;

hr = pSprite->Begin();
if(FAILED(hr))
break;
hr = pSprite->Draw(pTexture,
NULL,
NULL,
NULL,
0,
&Position, //NULL,
D3DCOLOR_RGBA(255,255,255,255));

hr = pSprite->End();
if(FAILED(hr))
break;
hr = pID3DDevice->EndScene();
if(FAILED(hr))
break;

// flip back buffer to front
hr = pID3DDevice->Present(NULL, NULL, NULL, NULL);

Share this post


Link to post
Share on other sites
I have some sample tutorial code available on my website. The actual tutorial is not written though. You can get the code here. Please feel free to email me with any questions about the code.

Kevin

-----------------------------
kevin@mayday-anime.com
http://dainteractive.mayday-anime.com

Share this post


Link to post
Share on other sites