示例#1
0
// SpaceNew creates a new space.
func SpaceNew() Space {
	s := Space(unsafe.Pointer(C.cpSpaceNew()))
	spaceDataMap[s] = &spaceData{}
	postStepCallbackMap[s] = make(map[interface{}]func(Space, interface{}))
	collisionHandlerMap[s] = make(map[collisionTypePair]collisionHandler)
	return s
}
示例#2
0
// SpaceNew creates a new space.
func SpaceNew() *Space {
	s := Space(Pointer(C.cpSpaceNew()))
	m := make(map[interface{}]func(*Space, interface{}))
	postStepCallbackMap[s] = &m
	return &s
}
示例#3
0
func NewSpace() *Space {
	var cpspace *C.cpSpace = C.cpSpaceNew()
	return &Space{cpspace, nil}
}
示例#4
0
文件: chipmunk.go 项目: andrebq/exp
func NewSpace() Space {
	return Space{s: C.cpSpaceNew()}
}
示例#5
0
// Allocate and initialize a Space.
func NewSpace() *Space {
	space := new(Space)
	space.ptr = C.cpSpaceNew()
	return space
}