|
Post by Azan on Aug 15, 2005 15:11:18 GMT -5
Have you ever had the unstoppable urge to shape a triangle?, ever got a great idea for a triangle but dont want to risk your life using a sharp pencil or pen? Well now you dont need to, just use this program. Graphics 800,600 SetBuffer BackBuffer() Global held=False ;if true wont grap anything new Type point Field x,y,name$,l1$,l2$,held End Type createpoint(100,100,"2","1","3") createpoint(200,200,"1","3","1") createpoint(300,200,"3",0,0) While Not KeyHit(1) Flip Cls update() Wend End
Function createpoint(x,y,name$,l1$,l2$) p.point=New point p\x=x p\y=y p\name$=name$ p\l1$=l1$ p\l2$=l2$ End Function
Function update() For p.point=Each point Color 255,255,255 Rect p\x,p\y,15,15 Color 255,0,0 Text p\x,p\y+5,p\name$ Color 255,255,255 mx=MouseX() my=MouseY() If Not p\l1$=0 Then If Not p\l2$=0 Then Line p\x,p\y,pointx(p\l1$),pointy(p\l1$) Line p\x,p\y,pointx(p\l2$),pointy(p\l2$) EndIf EndIf If mx>=p\x And mx<=p\x+15 Then If my>=p\y And my<=p\y+15 Then If MouseDown(1) And held=False Then p\held=True held=True EndIf EndIf EndIf If p\held=True Then p\x=mx p\y=my EndIf If Not MouseDown(1) Then p\held=False held=False EndIf
Next End Function
Function pointx(name$) For p.point=Each point If p\name$=name$ Then Return p\x EndIf Next End Function Function pointy(name$) For p.point=Each point If p\name$=name$ Then Return p\y EndIf Next End Function
|
|