Graphics 640,480,0,0 Type TRGB Field Red:Int Field Green:Int Field Blue:Int End Type Global mx:Float = -1 Global my:Float = -1 Global oldmx:Float Global oldmy:Float Global colours:TRGB[4] 'create an array 4 elements long with a TRGB type in each Global colourindex : Int = 0 'randomly assign colours, but could just as easily manually set any colours we want SeedRnd(MilliSecs()) ' the most common way of ensuring we get a truly random number For a:Int = 0 To 3 colours[a] = New TRGB colours[a].Red = Rand(128,255) colours[a].Green = Rand(128,255) colours[a].Blue = Rand(128,255) Next While Not KeyDown(KEY_ESCAPE) If MouseDown(1) Then If Mx And My > -1 Then oldMx = mx OldMy = my Else oldMx = MouseX() oldMy = MouseY() EndIf mx = MouseX() my = MouseY() For f:Int = 0 To 1 'draw it twice since we don't want to have flickering in fullscreen when we flip SetColor(colours[colourindex].Red,colours[colourindex].Green,colours[colourindex].Blue) DrawLine(oldMX, oldMY, mx, my) Flip Next colourindex:+1 If colourindex>3 Then colourindex = 0 Else mx = -1 my = -1 EndIf FlushMem Wend End