Jump to content
  • Advertisement
Sign in to follow this  
Gary the Llama

Should my 2D engine use ID3DXSPRITE for tiles?

This topic is 3989 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'm working on a simple 2D engine in DirectX 9 and am already using ID3DXSPRITE for my sprites... Should I be using ID3DXSPRITE for my tiles (it's a scrolling tile-based engine) too or is there another alternative? Right now I'm just blitting from surface to the screen and it seems okay, but I feel like there should be a better way.

Share this post


Link to post
Share on other sites
Advertisement
I don't see why there's anything wrong with using ID3DXSPRITE for your tiles. Tiles are just sprites themselves, really.

Share this post


Link to post
Share on other sites
Yes, ID3DXSprite is a good choice for this. If you can manage to get as many tiles onto one texture as possible, you'll see better performance too.

Share this post


Link to post
Share on other sites
Here's another dumb question - but related... Since I'm going to be using ID3DXSPRITE for everything, do I need to even define my own custom vertex format like so?

struct Vertex
{
float x, y, z, rhw;
D3DCOLOR color;
float u, v;
};


Edit:

Additionally, would these be correct?

CreateVertexBuffer(sizeof(LPD3DXSPRITE) * num, NULL, D3DFVF_VERTEX, D3DPOOL_MANAGED, &vertexBuffer, NULL);
d3ddev->SetStreamSource(0, vertexBuffer, 0, sizeof(LPD3DXSPRITE));

Instead of passing in my custom vertex format, would I pass in the LP3DXSPRITE? I could be way off base here, so please let me know if I am.

[Edited by - Gary the Llama on September 16, 2007 1:40:02 PM]

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!