Animation with ID3DXSprite
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
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement