Code archives/Graphics/Draw Line With Mouse
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Click mouse button 1 to place first coordinate. Click mouse button 2 to place the second coordinate which will draw the line. | |||||
'Written by David Schwartz - http://www.devdave.net Graphics 640,480,0 SetColor(255,255,255) Global firstmousex = 0 Global firstmousey = 0 Global secondmousex = 0 Global secondmousey = 0 Global first = False Global second = False Repeat If MouseHit(1) Then firstmousex = MouseX() firstmousey = MouseY() SetColor (255,0,0) DrawOval firstmousex,firstmousey,4,4 SetColor(255,255,255) first = True EndIf If MouseHit(2) Then secondmousex = MouseX() secondmousey = MouseY() SetColor (255,0,0) DrawOval secondmousex,secondmousey,4,4 SetColor(255,255,255) second = True EndIf If first = True And second = True Then DrawLine firstmousex,firstmousey,secondmousex,secondmousey first = False second = False EndIf Flip Until KeyHit(key_escape) |
Comments
| ||
Just fooling around with lines.. |
Code Archives Forum