Code: Select all
#screenwidth = 640
#screenheight = 480
InitSprite()
OpenWindow(0, 0, 0, #screenwidth, #screenheight, "PB Drawing", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, #screenwidth, #screenheight, 0, 0, 0, #PB_Screen_NoSynchronization)
fpscounter.i = 0
timer.i = 0
fps.i = 0
frames.i = 0
totalTime.l = 0
curTime.l = ElapsedMilliseconds()
Repeat
lastTime = curTime
curTime = ElapsedMilliseconds()
totalTime + (curTime-lastTime)
If(totalTime>1000)
totalTime-1000
fps = frames
frames = 0
EndIf
frames + 1
StartDrawing(WindowOutput(0))
For i = 0 To 20
Box(Random(320), Random(240), Random(320), Random(240), Random($FFFFFF) )
Next i
DrawText(20, 430, Str(fps))
StopDrawing()
FlipBuffers()
Until WindowEvent() = #PB_Event_CloseWindow
