[bmx] Draw Line With Mouse by IKG [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:40

Previous topic - Next topic

BlitzBot

Title : Draw Line With Mouse
Author : IKG
Posted : 1+ years ago

Description : Click mouse button 1 to place first coordinate. Click mouse button 2 to place the second coordinate which will draw the line.

Code :
Code (blitzmax) Select
'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 :


IKG(Posted 1+ years ago)

 Just fooling around with lines..