|
NewShape | |
Index = NewShape(NumbOfVertex, NumbOfEdges) | |
Parameters: NumbOfVertex = The number of vertex NumbOfEdges = The number of edges |
|
Returns: Index = The Index of the newly created shape |
|
The NewShape function dynamically create a new shape with a specified number vertex and edges ready for use. NewShape return the Index of this new shape back to the user. Shapes have a dual purpose in PlayBASIC, you can use them to render filled polygons or for complex collision operations if you like. To construct a shape we need two things. First we define a set of points (called vertex). The points are the corners of your shape. Next we join these points together to form the edges of the shape. The edges that we connect are assumed to create an enclosed space. But they don't actually have to, as one of the beauties of shapes, is we can pretty much join any points we like together, and the DrawShape command will try and render it. FACTS: * Shape Vertex indexes ranges between Zero and MaxVertex-1 * Shape Edge indexes ranges between Zero and MaxEdges-1 Mini Tutorial: This example creates a shape. First it initializes the shape, then it defines a list of vertex and then connects these points as edges.
This example outputs. |
Related Info: | CreateConvexShape | CreateShape | LoadNewShape | LoadShape | SaveShape : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |