Jump to content
  • Advertisement
Sign in to follow this  
Scoopa

Wrong with Sprite Function

This topic is 4809 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there somthing I am missing with this? void DrawSprite(IDirect3DDevice8 *pD3Ddev, int iX, int iY, LPDIRECT3DTEXTURE8 text) { RECT Rect; Rect.left = iX; Rect.top = iY; Rect.right = Rect.left + 100; Rect.bottom = Rect.top + 100; LPD3DXSPRITE Sprite; D3DXCreateSprite(pD3Ddev, &Sprite); Sprite->Begin(); Sprite->Draw(text, &Rect, &D3DXVECTOR2(1.0, 1.0), NULL, 0, NULL ,0xFFFFFFFF); Sprite->End(); } I can draw in other ways and I know the function I use to load the texture works because I use it in other areas. But, for some reason I cannot get the sprite function to draw to the screen! Any help would be appreciated!

Share this post


Link to post
Share on other sites
Advertisement
Hmm, I wouldn't even think that would compile because you're passing in the texture as an object, and not a pointer, and I think the draw function needs an address/pointer. So I think it would have had to be (&text,...). Also, you shouldn't create a new sprite object everytime you want to draw something. You should create a sprite object somewhere in a more global position, and just pass it in.

Edit:Anyways, it seems you're using a very dated DirectX version here. Consider updating, the ID3DXSprite interface was vastly improved with the earlier releases.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!