directx animation HOW???
I have read the lamothe''s game guru book. He explains the BOB engine in there for animation. I think it is too complicated! Does anybody have a simple way to do animation in directx? Just a way to load several bitmaps in order and that is it. I don''t want any dead state alive state arrays or whatever. THX!
To keep the animation simple, you should start out with a surface with the sprite data on it and use the Blt function along with changing your RECT structure to point to the desired data.
sprite.left=0;
sprite.right=64;
sprite.top=0;
sprite.bottom=64;
surf->Blt(&sprite,.....); // sorry too lazy to type =)
Use an array to make a table to the sprite data... that''s your animation sequence table. the alive...state states etc.. are just flags to the sprite structure. I made my own sprite structure to be more comfortable with animation as well.
I hope that helped out.
sprite.left=0;
sprite.right=64;
sprite.top=0;
sprite.bottom=64;
surf->Blt(&sprite,.....); // sorry too lazy to type =)
Use an array to make a table to the sprite data... that''s your animation sequence table. the alive...state states etc.. are just flags to the sprite structure. I made my own sprite structure to be more comfortable with animation as well.
I hope that helped out.
The BOB thing is not terribly good. Make your own one. You only need a structure to contain the x and y positions of the sprite, the current animation frame, when to change etc. Then use Blt or BltFast to render it to the screen every frame.
#pragma twice
#pragma twice
You''ll need a timer that you can set so that it''s not so fast that you only see a blur. Like this:
JoeMont001@aol.com
int timer;...if(GetTickCount()%10==1) //adjust this for timingtimer++;switch(timer){case 1: draw_frame_one();...}if(timer>=last_frame_number)timer=1;
JoeMont001@aol.com
I usually use the vertical sync for a timer. That way I know how many FPS I am theorically going to have.
it goes something like this
while (vsync)
{
//main program loop
}
//but the problem is the computer is waiting for the vsync to do anything. Probably a multithreaded application could work its way around this.
it goes something like this
while (vsync)
{
//main program loop
}
//but the problem is the computer is waiting for the vsync to do anything. Probably a multithreaded application could work its way around this.
It depends on your refresh rate. So people with a high refresh rate will have a higher VSync rate.
...and the refresh rate depends on the monitor. Usually it''s from 60 to 100 Hz.
lntakitopi@aol.com | http://geocities.com/guanajam/
lntakitopi@aol.com | http://geocities.com/guanajam/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement