Skip to main content
gamedev.net
🔒 Locked

Wrong with Sprite Function

Started by Scoopa Sep 14, 2005 at 12:08 PM 0 replies 450+ views
Original Post
Scoopa
Scoopa
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!
PoLiSh_Peta
PoLiSh_Peta
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.
There are two inevitabilities in life: death and failure.-PoLiSh

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.