RefreshShape allows you to manually refresh the shapes bounding box / circle size. Which is mostly used when drawing shapes or shapes are used for sprite collision. RefreshShape is generally only required if you've altered the shapes vertex or edges dynamically. If so, it's best to call it.
FACTS:
* RefreshShape updates the shapes bounding box / circle sizes which is used for shape collisions and intersections with shapes.
Mini Tutorial:
This example creates a shape, defines
; Create MySHape, with room for 10 vertex and ; 10 edge connections MyShape=NewShape(10,10) ; Set the 5 vertex positions in this shape ; Set vertex #1, -50x,-50y SetShapeVertex MySHape,1,-50,-50 SetShapeVertex MySHape,2,50,-50 SetShapeVertex MySHape,3,50,50 SetShapeVertex MySHape,4,-50,50 SetShapeVertex MySHape,5,-20,-20 SetShapeVertex MySHape,6,20,-20 SetShapeVertex MySHape,7,20,20 SetShapeVertex MySHape,8,-20,20 ; Connect the vertex together to form the edges ; Connect outter edges SetShapeEdge MyShape,1,1,2 SetShapeEdge MyShape,2,2,3 SetShapeEdge MyShape,3,3,4 SetShapeEdge MyShape,4,4,1 ; connect inner edges SetShapeEdge MyShape,5,5,6 SetShapeEdge MyShape,6,6,7 SetShapeEdge MyShape,7,7,8 SetShapeEdge MyShape,8,8,5 ; Force PlayBASIC to Refresh this shapes Bounding box ;/ Bounding Circle of this, just in case you might be ; using it for collision or display. RefreshShape MyShape ; Enable Debug mode for the shape, which shows the Circle ShapeDebug MyShape,true ; Draw the shapes points CenterText 100,20,"Shape Vertex" DrawShape MyShape,100,100,0 ; Draw the outline (edges) of this shape CenterText 250,20,"Shape Edges" DrawShape MyShape,250,100,1 ; Draw the Filled shape CenterText 400,20,"Filled Shape" DrawShape MyShape,400,100,2 Sync WaitKey |
This example outputs,
|