directx animation HOW???

Started by
6 comments, last by arwez 23 years, 10 months ago
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!
Advertisement
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.

The nightmare travels across the cosmos with his burning mane. The trail of ash that is produced.

?Have a nice day!?

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
You''ll need a timer that you can set so that it''s not so fast that you only see a blur. Like this:
    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
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
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.

The nightmare travels across the cosmos with his burning mane. The trail of ash that is produced.

?Have a nice day!?

Is the vertical retrace rate the same on everybody''s computer?

JoeMont001@aol.com
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
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/

This topic is closed to new replies.

Advertisement