mirror of
https://github.com/bloeys/physx-go.git
synced 2025-12-29 07:58:20 +00:00
Fix PVD connection
This commit is contained in:
3
main.go
3
main.go
@ -6,10 +6,9 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
f := pgo.CreateFoundation()
|
f := pgo.CreateFoundation()
|
||||||
defer f.Release()
|
|
||||||
println("foundation:", f)
|
println("foundation:", f)
|
||||||
|
|
||||||
pvdTr := pgo.DefaultPvdSocketTransportCreate("0.0.0.0", 5426, 100000)
|
pvdTr := pgo.DefaultPvdSocketTransportCreate("127.0.0.1", 5425, 100000)
|
||||||
println("Pvd transport:", pvdTr)
|
println("Pvd transport:", pvdTr)
|
||||||
|
|
||||||
pvd := pgo.CreatePvd(f)
|
pvd := pgo.CreatePvd(f)
|
||||||
|
|||||||
@ -34,7 +34,6 @@ void CPxSceneDesc_set_gravity(struct CPxSceneDesc*, struct CPxVec3);
|
|||||||
void CPxSceneDesc_set_cpuDispatcher(struct CPxSceneDesc*, struct CPxCpuDispatcher*);
|
void CPxSceneDesc_set_cpuDispatcher(struct CPxSceneDesc*, struct CPxCpuDispatcher*);
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
type PvdInstrumentationFlag uint32
|
type PvdInstrumentationFlag uint32
|
||||||
|
|
||||||
@ -91,11 +90,9 @@ func (p *PvdTransport) Release() {
|
|||||||
|
|
||||||
func DefaultPvdSocketTransportCreate(host string, port, timeoutMillis int) *PvdTransport {
|
func DefaultPvdSocketTransportCreate(host string, port, timeoutMillis int) *PvdTransport {
|
||||||
|
|
||||||
hostCStr := C.CString(host)
|
//This CString should NOT be freed because its stored internally. If this is freed connection to PVD will fail
|
||||||
defer C.free(unsafe.Pointer(hostCStr))
|
|
||||||
|
|
||||||
p := &PvdTransport{}
|
p := &PvdTransport{}
|
||||||
p.cPvdTr = C.CPxDefaultPvdSocketTransportCreate(hostCStr, C.int(port), C.int(timeoutMillis))
|
p.cPvdTr = C.CPxDefaultPvdSocketTransportCreate(C.CString(host), C.int(port), C.int(timeoutMillis))
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user