vsync
Prototypes:
- vsync();
- vsync(char nb_frame);
Arguments:
- nb_frame: The number of vsyncs to wait for
Description:
This function can be used to sync your program to the vertical blanking signal (VBL). Without an argument, this function returns as soon as a VBL signal has been received. With an argument, this function returns when the specified number of VBLs has been received. This signal is received 60 times per second, so it is easy to lock your game loop to 60fps by using a single vsync() at the end of your game loop. A vsync(3) at the end of your game loop will wait for 3 VBLs, effectively setting your game loop to 20fps. Using vsync() is also critical on real hardware when using palette routines; proper use of vsync() eliminates the "snow" effect when palette changes happen too quickly.
See Also:
Video Overview | Palette Overview