• Advertisement

Archived

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

Animation with ID3DXSprite

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

hi all I am trying to make simple animation with ID3DXSprite ( 4 or 5 frames ) , but i can''t get it done i want to blit 4 frames per second but i dont know how ... you can post a code for that if you want to thanxx in advance be patient with me plzz

Share this post


Link to post
Share on other sites
Advertisement
Just simply load X number of textures.

LPDIRECT3DTEXTURE8 frames[4];
D3DXCreateTextureFromFileExA(....params.... &frames[0]);
D3DXCreateTextureFromFileExA(....params.... &frames[1]);
D3DXCreateTextureFromFileExA(....params.... &frames[2]);
D3DXCreateTextureFromFileExA(....params.... &frames[3]);

and then change the render of your sprite

int curr_frame = 0;

// main loop
curr_frame++;
if (curr_frame > 3)
curr_frame = 0;

// sprite is your ID3DXSprite interface
sprite.Draw(frames[curr_frame], ...other params...);

thats it

-Vulcan

Share this post


Link to post
Share on other sites

  • Advertisement