Jump to content
  • Advertisement
Sign in to follow this  
Soaps79

LPD3DXSPRITE usage

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

Hey all, programming student here. We have done some introductory API work, and I am about to begin a project on the side.

What I am wondering is how an average 2D game will use the LPD3DXSPRITE object. Basically, is there one for the entire program that draws everything during my game_run loop, or should each class (ship, bullet, asteroid for example) have their own LPD3DXSPRITE as a member variable?

I am drawn to think that each object should have its own, but then I also think that it could be like the LPDIRECT3D9 object that has only one instantiation.

Any input or useful links are much appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Although you aren't limited to a single instantiation, it's better to use fewer. In many cases you shouldn't even need to use more than one. Think of it as batching. Each ID3DXSprite essentially allows a batch of sprites to be drawn in one go, so using a different ID3DXSprite for every sprite you want to draw negates the performance gains acquired by using the ID3DXSprite interface.

Try to stick to one ID3DXSprite if you can.

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!