Here is a simple Polygon without API.
But how to found a secure starting point for the FillArea command?
Code: Select all
Structure Polyg
p.POINT
EndStructure
NewList Po.Polyg()
Procedure Polyg(Po.Polyg(),RGB)
FirstElement(Po())
x=Po()\p\x:y=Po()\p\y
FirstX=x:FirstY=y
While NextElement(Po())
X1=Po()\p\x:Y1=Po()\p\y
LineXY( x,y, X1,Y1)
x=X1:y=Y1
Wend
LineXY(x,y,FirstX,FirstY) ; close shape
FillArea(X1+1,Y1+1,0,RGB) ;Bad starting point *********
EndProcedure
;_____________________________
OpenWindow(0,0,0,0,0,"", #WS_OVERLAPPEDWINDOW | #WS_MAXIMIZE)
StartDrawing(WindowOutput(0))
Restore Polyg:
For i=1 To 10
AddElement(Po())
Read Po()\p\x:Read Po()\p\y
Next
Polyg(@Po(),#Green)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
DataSection
Polyg:
Data.l 100,200, 250,200, 300,75, 350,200, 500,200, 400,300, 450,425, 300,350, 150,425, 200,300
enddatasection