Take a look at this:
SetGraphicsDriver GLMax2DDriver(),0
Graphics( 800, 600, 32, 60, 0)
HideMouse()
MoveMouse GraphicsWidth()/2, GraphicsHeight() / 2
Local OldMouseX:Float = MouseX()
Local OldMouseY:Float = MouseY()
Local newmousex:Int
Local newMousey:Int
Local t:Int, temp:Int
Local Before:Int=MilliSecs()
Local RightNow:Int
Local fps:Int
Local AFPS:Int,ACount:Int=0
Local Effect=0
Cls
For t=0 To 100
SetColor Rand(0,255),Rand(0,255),Rand(0,255)
DrawRect 20+t*4,20+t*4,100,100
SetColor 255,255,255
Plot t,t
DrawText "test",t*4,t*4
Next
While Not KeyDown( KEY_ESCAPE)
If KeyDown(KEY_SPACE) Then effect=1-effect
SetColor 0,0,0
DrawRect OldMouseX ,oldMouseY,20,20 'cleaning up after the mouse
SetColor 255,255,255
newmousex=Int(MouseX())
newMousey=Int(MouseY())
SetColor 255,255,255
DrawRect NewMouseX ,NewMouseY,20,20
SetColor 155,25,2
DrawOval newMouseX ,newMouseY,20,20
If effect
For t=0 To 2000
SetColor Rand(0,255),Rand(0,255),Rand(0,255)
Plot Rand(40,600),Rand(40,500)
Next
Else
For t=0 To 2000
SetColor Rand(0,255),Rand(0,255),Rand(0,255)
DrawRect newMouseX+30+(t/10) ,newMouseY+30,20,20
Next
EndIf
OldMouseX =newMouseX
OldMouseY =newMouseY
RightNow=MilliSecs()
temp=RightNow-Before
If temp<1 Then temp=1
FPS=1000/temp
Before=RightNow
ACount=ACount+1
AFPS=(AFPS+FPS)/2
If ACount=100
ACount=0
SetColor 0,0,0
DrawRect 20 ,20,40,20
SetColor 255,255,255
DrawText afps,20,20
EndIf
Flip 0 'Has probably absolute no meaning(does Nothing?)
Wend
EndGraphics
Perhaps it's dirty and not save? because I have no knowledge of GraphicsDrivers whatsoever.
But it "seems" to work.