package android28 /* #cgo CFLAGS: -x objective-c -fno-objc-arc #cgo LDFLAGS: -landroid -llog -lnativewindow -lm #import #import typedef struct { float x; float y; float z; int8_t status; } ASensorVector2; ASensorVector2 ASensorAcceleration(ASensorEvent* event) { ASensorVector2 ret; ret.x = event->acceleration.x; ret.y = event->acceleration.y; ret.z = event->acceleration.z; ret.status = event->acceleration.status; return ret; } ASensorEventQueue* ASensorManager_createEventQueue2(ASensorManager* manager, ALooper* looper, int ident) { return ASensorManager_createEventQueue(manager, looper, ident, 0, 0); } */ import "C" type ASensorVector C.ASensorVector2 func (x ASensorVector) X() Float { return (Float)(x.x) } func (x ASensorVector) Y() Float { return (Float)(x.y) } func (x ASensorVector) Z() Float { return (Float)(x.z) } func (x *ASensorEvent) Acceleration() ASensorVector { return (ASensorVector)(C.ASensorAcceleration(x)) } func ASensorManagerCreateEventQueue(manager *ASensorManager, looper *ALooper, ident int) *ASensorEventQueue { ret := (*ASensorEventQueue)(C.ASensorManager_createEventQueue2((*C.ASensorManager)(manager), (*C.ALooper)(looper), (C.int)(ident))) return ret }