Sprites flickering
HELP!!!
If sprite move slow it''s flickering. What I need to do to stop this flickering?
Sprite move slow about 0.6 Pixel per 1/85 sec.
LARGE_INTEGER Time;
double Delta;
QueryPerformanceCounter(&Time);
Delta=(double)(Time.LowPart-g_aSpriteArray.m_uLastTickCount)/SS_MOVESPPED_H;
I also use next to limit FPS (40fps)
do
{
QueryPerformanceCounter(&TimeEnd);
Diff=TimeEnd.LowPart-TimeStart.LowPart;
}
while(Diff<(1/40Sec));
The only real way to stop flickering is to use double buffering. Ie :
while(game_is_running){
gr_clear_screen();
gameplay_process_all();
gameplay_render_all();
gr_flip_buffers();
calc_frametime();
}
That''s about as basic as it gets. 99.99% of all retail games out there use almost exactly that.
while(game_is_running){
gr_clear_screen();
gameplay_process_all();
gameplay_render_all();
gr_flip_buffers();
calc_frametime();
}
That''s about as basic as it gets. 99.99% of all retail games out there use almost exactly that.
Volition, Inc.
When using double buffering it is also a good idea to sync on the VSync of the monitor to avoid tearing. If using DirectX, this is in the SDK documentation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement