Jump to content
  • Advertisement
Sign in to follow this  
ridefast42

Directx Sprite Interface

This topic is 4333 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 am trying to learn directx9's sprite interface for use with 2-d games. The problem is, I can't find any good tutorials on the subject and learning it mainly from the documentation is not easy(too much trial and error for an inpatient teenager). Anyone know of any good sites or anything like that for learning the sprite interface for c++?

Share this post


Link to post
Share on other sites
Advertisement
DirectX9?

The basics (I am a C# programmer) are as such.

You need to load an image into a Texture object.
You also need to create a new instance of the sprite object with a valid Direct3D Device.
Then call Sprite.(->)Begin(...), then Sprite.(->)Draw(...) followed by Sprite.(->)End(); within the Device's rendering calls.

Here is my sprite class for C#/MDX9
http://hstuart.dk/paste/view.aspx?id=1230840f-0b7f-44ab-ad5b-8870ddd3536f

Share this post


Link to post
Share on other sites
Its not all that hard to learn once you know the basics of direct3d (which I'm assuming you do since you're only asking about the sprite interface).
You just call ID3DXSprite::Begin(), draw the textures with ID3DXSprite::Draw(), and call ID3DXSprite::End() all between your BeginScene() and EndScene() calls.

You can load the image into an LPDIRECT3DXTEXTURE9 using a variety of calls but I prefer D3DXCreateTextureFromResourceEx() because it allows you to set up source keying and other helpful things fairly easily and just add default parameters for the things you dont care about.

Thats pretty much all there is to it...I had trouble finding a tutorial myself and ended up just using the microsoft documentation, but it is a lot easier than it seems.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!