il permet de tracer une ligne toute en controlant l'epaisseur
voila un exemple qui l'illustre:
presser space pour ajouter un point .(Nb la procedure est gourmente)
Code : Tout sélectionner
;-----------spirit--------------------
Procedure.f angle(x1.f,y1.f,xc.f,yc.f)
t.f
r.f=Sqr(Pow(x1-xc,2)+Pow(y1-yc,2))
If y1>yc
If x1>=xc:t=ACos((x1-xc)/r):EndIf
If xc>=x1:t=ACos((xc-x1)/-r):EndIf
EndIf
If yc>y1
If x1>xc:t=-ACos((x1-xc)/r):EndIf
If xc>=x1:t=-ACos((xc-x1)/-r):EndIf
EndIf
If yc=y1
If x1>=xc:t=0:EndIf
If xc>x1:t=-#PI:EndIf
EndIf
ProcedureReturn t
EndProcedure
Procedure ligne(x1.f,y1.f,x2.f,y2.f,ep,c.f)
re.f=Sqr(Pow(x1-x2,2)+Pow(y1-y2,2))
te.f=angle(x1.f,y1.f,x2.f,y2.f)
For r=0 To Abs(re) Step 2
xp.f=x2+(r*Cos(te))
yp.f=y2+(r*Sin(te))
Circle(xp,yp,ep,c)
Next
EndProcedure
Macro add()
If KeyboardReleased(#PB_Key_Space)
AddElement(p())
p()\x=xm:p()\y=ym
EndIf
EndMacro
Structure point
x.f
y.f
EndStructure
NewList p.point()
InitSprite():InitKeyboard():InitMouse()
#width=800
#hight=600
OpenWindow(0, 216, 0, #width,#hight, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar )
OpenWindowedScreen(WindowID(0),0,0,#width,#hight,1,0,0)
Repeat
FlipBuffers():ExamineMouse():ExamineKeyboard():ClearScreen(0)
xm=MouseX():ym=MouseY():add()
StartDrawing(ScreenOutput())
ForEach p()
If NextElement(p()):x1=p()\x:y1=p()\y:PreviousElement(p()):EndIf
ligne(x1,y1,p()\x,p()\y,4,255)
Next
Circle(xm,ym,5,255)
StopDrawing()
Until WaitWindowEvent()=#PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)