Hi guys,
Got my very first program ported from the GP32 to the GP2x: ... the good old Bolcataxian from ADIC2004.
It worked pretty quickly, but without sound, as I had to disable SDL_mixer till there is a fully working lib...
But, but... well, erm: it's kind of slow.
About half the speed of the GP32 version which was working with direct screen access.
I was wondering:
1- Is SDL pretty optimised?
2- I didn't find a way to properly wait for the VBL (yet) in SDL, if you guys had the ideal timings I am suppose to wait? Maybe I am just waiting too long at the moment with 20ms? (see below, bit of code I was using fine on the Win32/macOS port a few months back)
Any better idea??
Cheerio!
JBB
current_ticks = SDL_GetTicks();
// wait for 60fps
int d = (current_ticks - ticks);
if ( d < 20 )
{
SDL_Delay( 20 - d ); // wait for 50fps
ticks = current_ticks + d;
}
else
{
ticks = current_ticks; // over 1 frame! eek.
}
SDL_Flip(screen);
Got my very first program ported from the GP32 to the GP2x: ... the good old Bolcataxian from ADIC2004.
It worked pretty quickly, but without sound, as I had to disable SDL_mixer till there is a fully working lib...
But, but... well, erm: it's kind of slow.
About half the speed of the GP32 version which was working with direct screen access.
I was wondering:
1- Is SDL pretty optimised?
2- I didn't find a way to properly wait for the VBL (yet) in SDL, if you guys had the ideal timings I am suppose to wait? Maybe I am just waiting too long at the moment with 20ms? (see below, bit of code I was using fine on the Win32/macOS port a few months back)
Any better idea??
Cheerio!
JBB
current_ticks = SDL_GetTicks();
// wait for 60fps
int d = (current_ticks - ticks);
if ( d < 20 )
{
SDL_Delay( 20 - d ); // wait for 50fps
ticks = current_ticks + d;
}
else
{
ticks = current_ticks; // over 1 frame! eek.
}
SDL_Flip(screen);