Example #1
0
func NewPolyShape(body *Body, verts []Vect, offset Vect) *Shape {
	cpverts := make([]C.cpVect, 0)
	for _, vert := range verts {
		cpverts = append(cpverts, vert.CPVect)
	}
	var cpshape *C.cpShape = C.cpPolyShapeNew(body.CPBody, C.int(len(verts)), &cpverts[0], offset.CPVect)
	return createAndRegister(cpshape)
}
Example #2
0
// PolyShapeNew creates a new polygon shape.
func PolyShapeNew(b Body, verts []Vect, offset Vect) PolyShape {
	v := (*C.cpVect)(unsafe.Pointer(&verts[0]))
	s := C.cpPolyShapeNew(b.c(), C.int(len(verts)), v, offset.c())
	return PolyShape{cpshape(s)}
}