LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

VS​YNC

Root / Submissions / [.]

12Me21Created:
VSYNC [ frames ] VSYNC n will pause the program until n frames (screen updates, which happen 60 times per second) have passed since the last time VSYNC or WAIT was called. If no value is given, it defaults to 1. The main use of VSYNC is to limit the speed of your code. The 3DS's screen only updates (approximately) 60 times per second, so drawing graphics more often is pointless. This program will flicker, and the filled area will barely be visible:
WHILE 1
 GCLS
 GFILL 50,50,200,200
WEND
To fix this, use VSYNC:
WHILE 1
 GCLS
 GFILL 50,50,200,200
 VSYNC 'vsync after you finish drawing
WEND
This will let the screen update after you're finished drawing. Otherwise, you'll end up clearing the screen before the 3DS has a chance to display what was there. If you want your code to run at 30 FPS, you can use VSYNC 2. However, you'll have to use page swapping to avoid flicker.

Page swapping :
BUFFER = !BUFFER
GPAGE BUFFER, !BUFFER