? VSYNC ● SmileBASIC Source

Sign In

*Usernames are case-sensitive
Forgot my password
Contest results!


VSYNC [ frames ] VSYNC n will pause the program until n frames 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 anything faster 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.
1 vote
1 Comment(s) Warrior Warrior Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Drawing I like to draw! Hobbies Page swapping : BUFFER = !BUFFER GPAGE BUFFER, !BUFFER