Graphics 640,480,0,0 Global mx:Float = -1 Global my:Float = -1 Global oldmx:Float Global oldmy:Float 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(255,100,255) DrawLine(oldMX, oldMY, mx, my) Flip Next Else mx = -1 my = -1 EndIf 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(255,255,255) DrawLine(oldMX, oldMY, mx, my) Flip Next Else mx = -1 my = -1 EndIf 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(0,0,255) DrawLine(oldMX, oldMY, mx, my) Flip Next Else mx = -1 my = -1 EndIf 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(255,0,0) DrawLine(oldMX, oldMY, mx, my) Flip Next Else mx = -1 my = -1 EndIf FlushMem Wend End
weeeeeeeeeee
Miscellaneous Forums/Blitz Showcase/weeeeeeeeeee*EDIT*
I see you used the code sample I posted, but you really need to try and cut that code down a touch, repeating the same thing each time you want to change the colour is not the best way to do that.
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
why is this in the showcase ?
Because he acheived something and wants to show it off?
My guess being he's about 12, new to programming and getting excited about getting a working app.
remember what that was like?
My guess being he's about 12, new to programming and getting excited about getting a working app.
remember what that was like?
Nice :)
Nice colors! Dig it! :)