Jump to content
  • Advertisement

Archived

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

Moe

Problem with D3DXSprite functions...

This topic is 6298 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

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();
  
?

Share this post


Link to post
Share on other sites
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. -

Share this post


Link to post
Share on other sites
Nope, I still can''t get it working. I am doing it like:
  
//begin drawing

lpd3dxsprite->Begin();

Where lpd3dxsprite is declared like:
  
LPD3DXSPRITE* lpd3dxsprite;

What am I doing wrong? (I can post the whole thing if you want)

Share this post


Link to post
Share on other sites
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 object

D3DXCreateSprite(pD3DDevice, &Sprite);

pD3DDevice->BeginScene();
Sprite->Draw(......);
pD3DDevice->EndScene();

Sprite->Release();

Jim






Jim Adams
home.att.net/~rpgbook
Programming Role-Playing Games with DirectX 8

Share this post


Link to post
Share on other sites
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; .

Share this post


Link to post
Share on other sites

  • 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!