When I'm running my routine, it's kind smooth in windowed mode (full frame rate at 60 FPS on a 22" LCD) but it is not in fullscreen (30 FPS!)
I tryed differents bit depth, but it was the same, half speed only.
Also in windowed mode it's fast but the pixel looks like a line when the step is more than 1 pixel.
Here's the code, it's a 2D starfield. Sorry for the bad english.
Thanks for reading.
Code: Select all
' Windowed mode
SCREEN 800,600
' Fullscreen, it was half the speed on my computer (XP SP2, E2140 @ 3.2GHz, 2Go, 8800 GTS 320)
' SCREEN 800,600,32,0
' I don't know if it's ok to use this command here. I know it's for resize or rotate.
Smooth2D ON
'FPS color text
Color 0,255,0
'We need to keep and add/change values to stars
Dim star(1000)
' We want different X values for stars, otherwise they all start to the same point
For i = 1 To 600
star(i) = Rnd(800)
Next i
Repeat
'The lock screen function amazed me in term of speed.
Lock SCREEN()
'vit = speed, each lines (600) it adds 1 to 16 for paralax effect
'I need to know how to set RGB in PutPixel, I though it was something like 65535*R +255*G +B
'Also I'll like to know if there's a function like " inc var n" instead var = var + n
For i = 1 To 600
vit = 1 + Abs(16*Sin(i^3))
star(i) = star(i) + vit
If star(i) > 800 Then star(i) = 0
PutPixel star(i),i,30000000-20*vit
Next i
Unlock SCREEN()
Text 1,1,FPS()
DrawScreen
' I didn't put a command to clear the background, no cls or black box. Why it works ? It could be annoying for some effects. Thanks.
Forever