Пример #1
0
func GetString(dataRef DataRef) string {
	length := int(C.XPLMGetDatab(C.XPLMDataRef(dataRef), nil, 0, 0))
	valueBuffer := (*C.char)(C.malloc(C.size_t(length)))
	defer C.free(unsafe.Pointer(valueBuffer))
	C.XPLMGetDatab(C.XPLMDataRef(dataRef), unsafe.Pointer(valueBuffer), 0, C.int(length))
	return C.GoString(valueBuffer)
}
Пример #2
0
func SetFloatArrayData(dataRef DataRef, value []float32) {
	C.XPLMSetDatavf(C.XPLMDataRef(dataRef), (*C.float)(unsafe.Pointer(&value[0])), 0, C.int(len(value)))
}
Пример #3
0
func GetFloatArrayData(dataRef DataRef) []float32 {
	length := int(C.XPLMGetDatavf(C.XPLMDataRef(dataRef), nil, 0, 0))
	result := make([]float32, length)
	C.XPLMGetDatavf(C.XPLMDataRef(dataRef), (*C.float)(unsafe.Pointer(&result[0])), 0, C.int(length))
	return result
}
Пример #4
0
func SetIntArrayData(dataRef DataRef, value []int) {
	C.XPLMSetDatavi(C.XPLMDataRef(dataRef), (*C.int)(unsafe.Pointer(&value[0])), 0, C.int(len(value)))
}
Пример #5
0
func GetIntArrayData(dataRef DataRef) []int {
	length := int(C.XPLMGetDatavi(C.XPLMDataRef(dataRef), nil, 0, 0))
	result := make([]int, length)
	C.XPLMGetDatavi(C.XPLMDataRef(dataRef), (*C.int)(unsafe.Pointer(&result[0])), 0, C.int(length))
	return result
}
Пример #6
0
func SetDoubleData(dataRef DataRef, value float64) {
	C.XPLMSetDatad(C.XPLMDataRef(dataRef), C.double(value))
}
Пример #7
0
func GetDoubleData(dataRef DataRef) float64 {
	return float64(C.XPLMGetDatad(C.XPLMDataRef(dataRef)))
}
Пример #8
0
func SetIntData(dataRef DataRef, value int) {
	C.XPLMSetDatai(C.XPLMDataRef(dataRef), C.int(value))
}
Пример #9
0
func GetFloatData(dataRef DataRef) float32 {
	return float32(C.XPLMGetDataf(C.XPLMDataRef(dataRef)))
}
Пример #10
0
func GetDataRefTypes(dataRef DataRef) DataRefType {
	return DataRefType(C.XPLMGetDataRefTypes(C.XPLMDataRef(dataRef)))
}
Пример #11
0
func GetIntData(dataRef DataRef) int {
	return int(C.XPLMGetDatai(C.XPLMDataRef(dataRef)))
}
Пример #12
0
func IsDataRefGood(dataRef DataRef) bool {
	return C.XPLMIsDataRefGood(C.XPLMDataRef(dataRef)) == 1
}
Пример #13
0
func CanWriteDataRef(dataRef DataRef) bool {
	return C.XPLMCanWriteDataRef(C.XPLMDataRef(dataRef)) == 1
}
Пример #14
0
func SetString(dataRef DataRef, value string) {
	cValue := C.CString(value)
	defer C.free(unsafe.Pointer(cValue))
	C.XPLMSetDatab(C.XPLMDataRef(dataRef), unsafe.Pointer(cValue), 0, C.int(C.strlen(cValue)))
}
Пример #15
0
func GetData(dataRef DataRef) []byte {
	length := int(C.XPLMGetDatab(C.XPLMDataRef(dataRef), nil, 0, 0))
	result := make([]byte, length)
	C.XPLMGetDatab(C.XPLMDataRef(dataRef), unsafe.Pointer(&result[0]), 0, C.int(length))
	return result
}
Пример #16
0
func SetFloatData(dataRef DataRef, value float32) {
	C.XPLMSetDataf(C.XPLMDataRef(dataRef), C.float(value))
}
Пример #17
0
func UnregisterDataAccessor(dataRef DataRef) {
	C.XPLMUnregisterDataAccessor(C.XPLMDataRef(dataRef))
}
Пример #18
0
func SetData(dataRef DataRef, value []byte) {
	C.XPLMSetDatab(C.XPLMDataRef(dataRef), unsafe.Pointer(&value[0]), 0, C.int(len(value)))
}