Code: Select all
//the following is a sketch only
volatile int frame_counter=0;
void gfx_timer_clock(void)
{
frame_counter++;
}
END_OF_FUNCTION(gfx_timer_clock) //however, this statement doesn't seem to be REALLY necessary.
void blit_to_screen(BITMAP *bmp)
{
blit(bmp,screen, ... ); //parameters don't matter.
while(0 == frame_counter) {
Sleep(0); //it doesn't impact in the timer as you would might imagine...
}
frame_counter = 0;
//using an old_frame_counter to compare with frame_counter gives the exact same bad effect.
//it just don't reset the counter.
}
void gfx_timer_init(void)
{
install_timer();
LOCK_FUNCTION(gfx_timer_clock);
LOCK_VARIABLE(frame_counter);
install_int_ex(gfx_timer_clock,BPM_TO_TIMER(3606));
}