Problem with D3DXSprite functions...

Started by
4 comments, last by Moe 22 years, 9 months ago
I have been trying to get the D3DXSprite functions to work, so I can draw some simple 2D things on top of my 3D scene. I am doing it like so:
  
//begin 

Begin();

//draw the stuff using Draw()


/stop 
End();
  
It gives me 3 errors (one for each D3DXSprite function I use). It doesn''t seem to recognize those 3 functions. Do I need to do something like:
  
something->Begin();
  
?
Advertisement
Yes you do.
Assuming your sprite is called mySprite the calls would be

mySprite->Begin();
mySprite->Draw (/* Parameters */ );
mySprite->End();


Neophyte

- Death awaits you all with nasty, big, pointy teeth. -
Nope, I still can''t get it working. I am doing it like:
  //begin drawinglpd3dxsprite->Begin();  

Where lpd3dxsprite is declared like:
  LPD3DXSPRITE* lpd3dxsprite;  

What am I doing wrong? (I can post the whole thing if you want)
Actually, you don''t have to call ID3DXSprite::Begin or ID3DXSprite::End (as per MS DX SDK docs), as the interface will call those for you if you''re attempting to draw.

If you''re getting compiler errors, make sure you have included d3dx8.h and d3dx8.lib with your project, then declare, create, and use:

  #include "d3d8.h"#include "d3dx8.h"ID3DXSprite *Sprite;// Assuming pD3DDevice = pre-initialized device objectD3DXCreateSprite(pD3DDevice, &Sprite);pD3DDevice->BeginScene();Sprite->Draw(......);pD3DDevice->EndScene();Sprite->Release();Jim  


Jim Adams
home.att.net/~rpgbook
Programming Role-Playing Games with DirectX 8
quote:Original post by Moe
        LPD3DXSPRITE* lpd3dxsprite;    



If you''re putting that in it, there''s your problem. It should either be ID3DXSprite* lpd3dxsprite; or LPD3DXSPRITE lpd3dxsprite; .
Thanks fury, worked like a charm.

This topic is closed to new replies.

Advertisement