supercasiobros/src/framerate.c

36 lines
459 B
C

#include <gint/timer.h>
#include <gint/clock.h>
static volatile int has_ticked = 0;
int callback(volatile void *arg)
{
volatile int *has_ticked = arg;
*has_ticked = 1;
return 0;
}
void initRefreshTimer()
{
timer_setup(0, timer_delay(0, 50000), timer_Po_4, callback, &has_ticked);
timer_start(0);
}
void quitRefreshTimer()
{
timer_stop(0);
}
void waitNextFrame()
{
while (1)
{
if (has_ticked)
{
has_ticked=0;
return;
}
sleep();
}
}