gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > swiwaitforvblank from libnds

#76482 - swzte - Wed Mar 22, 2006 1:57 am

What's the purpose of swiwaitforvblank? This function comes from libnds.
Many people may have used this function? But who can tell?

#76493 - knight0fdragon - Wed Mar 22, 2006 3:29 am

it waits for the vsync to reset, so that u can draw with less flicker, it is about 1/60th of a second
_________________
http://www.myspace.com/knight0fdragonds

MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206

#76494 - genfish - Wed Mar 22, 2006 3:32 am

so is it possible to count these and use them to draw an animation instead of getting a time?
_________________
there is no rl only afk

#76520 - qw3rty - Wed Mar 22, 2006 11:06 am

Yes, that's what I do in my game....I only sync with the V-Blank.
But if your code needs more time for one "iteration" you could get slow-downs, if you sync with the time, you'll get choppy framerate in that case....But there should be plenty of time from V-Blank to V-Blank for most programs ;)

#76552 - knight0fdragon - Wed Mar 22, 2006 5:55 pm

basically u want to set up an interrupt for the vBlank so that when vsync is reset, it will go to this function, and will do everything in vBlank

to set up the interrupt

irqInit();
irqSet(IRQ_VBLANK, vBlank);
irqEnable(IRQ_VBLANK);


and somewhere else in ur code

void vBlank()
{
};
_________________
http://www.myspace.com/knight0fdragonds

MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206