1. If I make these globals, how can I make the points& variable be a pointer
to the TrianglePoints array or SquarePoints array or any other array I might
make sometime?
2. If "1" is too hard, how do I make an array of 10 vertex records in the
shape record?
3. Also, how do I pass the name of a record to a function?
DIM RECORD vertex
DIM x%
DIM y%
DIM END RECORD _vertex
DIM RECORD shape
DIM numOfVertices%
DIM color%
DIM points&
DIM END RECORD _shape
DIM TrianglePoints.vertex(3)
DIM SquarePoints.vertex(4)
DIM Triangle.shape
END GLOBALS
LOCAL FN drawshape(theShape)
FOR i = 1 TO theShape.numOfVertices
j = i + 1
IF j>theShape.numOfVertices THEN j = 1
COLOR theShape.color
PLOT theShape.points&.x(i),theShape.points&.y(i) TO 'continued on the next
line theShape.points&.x(j),theShape.points&.y(j)
NEXT
END FN
LOCAL FN Initialize
WINDOW 1
Triangle.numOfVertices = 3
Triangle.color = _zBlack
Triangle.points& = TrianglePoints
Triangle.points&.x(1) = 100
Triangle.points&.y(1) = 100
Triangle.points&.x(2) = 200
Triangle.points&.y(2) = 100
Triangle.points&.x(1) = 150
Triangle.points&.y(1) = 50
END FN
FN Initialize
FN drawshape(Triangle)
DO
UNTIL FN BUTTON