Animation with ID3DXSprite

Started by
1 comment, last by beginner_directx 22 years, 5 months ago
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
http://uae-arts.host.sk
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
thanxx but what if i want to play certain number of frames every 1 or 2 or x numbers of seconds ???

be patient with me
plzz
http://uae-arts.host.sk

This topic is closed to new replies.

Advertisement