mirror of
https://github.com/bloeys/physx-go.git
synced 2025-12-29 07:58:20 +00:00
Wrap some foundation+pvd classes
This commit is contained in:
Binary file not shown.
64
pgo/pgo.go
64
pgo/pgo.go
@ -8,13 +8,65 @@ package pgo
|
||||
#include <stdlib.h> //Needed for C.free
|
||||
|
||||
//Functions
|
||||
struct CPxFoundation* NewCPxFoundation();
|
||||
void FreeCPxFoundation(struct CPxFoundation*);
|
||||
struct CPxFoundation* CPxCreateFoundation();
|
||||
void CPxFoundation_release(struct CPxFoundation*);
|
||||
|
||||
struct CPxPvd* CPxCreatePvd(struct CPxFoundation*);
|
||||
void CPxPvd_release(struct CPxPvd*);
|
||||
|
||||
struct CPxPvdTransport* CPxDefaultPvdSocketTransportCreate(const char* address, int port, int timeoutMillis);
|
||||
void CPxPvdTransport_release(struct CPxPvdTransport* cppt);
|
||||
*/
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
func Test() {
|
||||
x := C.NewCPxFoundation()
|
||||
println("Result:", x)
|
||||
C.FreeCPxFoundation(x)
|
||||
type Foundation struct {
|
||||
cFoundation *C.struct_CPxFoundation
|
||||
}
|
||||
|
||||
func (f *Foundation) Release() {
|
||||
C.CPxFoundation_release(f.cFoundation)
|
||||
}
|
||||
|
||||
func CreateFoundation() *Foundation {
|
||||
|
||||
f := &Foundation{}
|
||||
f.cFoundation = C.CPxCreateFoundation()
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
type Pvd struct {
|
||||
cPvd *C.struct_CPxPvd
|
||||
}
|
||||
|
||||
func (p *Pvd) Release() {
|
||||
C.CPxPvd_release(p.cPvd)
|
||||
}
|
||||
|
||||
func CreatePvd(f *Foundation) *Pvd {
|
||||
|
||||
p := &Pvd{}
|
||||
p.cPvd = C.CPxCreatePvd(f.cFoundation)
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
type PvdTransport struct {
|
||||
cPvdTr *C.struct_CPxPvdTransport
|
||||
}
|
||||
|
||||
func (p *PvdTransport) Release() {
|
||||
C.CPxPvdTransport_release(p.cPvdTr)
|
||||
}
|
||||
|
||||
func DefaultPvdSocketTransportCreate(host string, port, timeoutMillis int) *PvdTransport {
|
||||
|
||||
hostCStr := C.CString(host)
|
||||
defer C.free(unsafe.Pointer(hostCStr))
|
||||
|
||||
p := &PvdTransport{}
|
||||
p.cPvdTr = C.CPxDefaultPvdSocketTransportCreate(hostCStr, C.int(port), C.int(timeoutMillis))
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@ extern "C" {
|
||||
void* obj;
|
||||
};
|
||||
|
||||
CPxAPI CSTRUCT CPxFoundation* NewCPxFoundation();
|
||||
CPxAPI void FreeCPxFoundation(CSTRUCT CPxFoundation* cpf);
|
||||
CPxAPI CSTRUCT CPxFoundation* CPxCreateFoundation();
|
||||
CPxAPI void CPxFoundation_release(CSTRUCT CPxFoundation* cpf);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
20
pgo/physx-c/CPxPvd.h
Executable file
20
pgo/physx-c/CPxPvd.h
Executable file
@ -0,0 +1,20 @@
|
||||
#ifndef __CPxPvd_H__
|
||||
#define __CPxPvd_H__
|
||||
|
||||
#include "CPxFoundation.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
struct CPxPvd
|
||||
{
|
||||
void* obj;
|
||||
};
|
||||
|
||||
CPxAPI CSTRUCT CPxPvd* CPxCreatePvd(CSTRUCT CPxFoundation*);
|
||||
CPxAPI void CPxPvd_release(CSTRUCT CPxPvd* cpp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
18
pgo/physx-c/CPxPvdTransport.h
Executable file
18
pgo/physx-c/CPxPvdTransport.h
Executable file
@ -0,0 +1,18 @@
|
||||
#ifndef __CPxPvdTransport_H__
|
||||
#define __CPxPvdTransport_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
struct CPxPvdTransport
|
||||
{
|
||||
void* obj;
|
||||
};
|
||||
|
||||
CPxAPI CSTRUCT CPxPvdTransport* CPxDefaultPvdSocketTransportCreate(const char* address, int port, int timeoutMillis);
|
||||
CPxAPI void CPxPvdTransport_release(CSTRUCT CPxPvdTransport* cppt);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,3 +1,4 @@
|
||||
#define CPxAPI
|
||||
#define CSTRUCT struct
|
||||
#include <CPxFoundation.h>
|
||||
#include <CPxPvd.h>
|
||||
|
||||
Reference in New Issue
Block a user