コード例 #1
0
ファイル: drawing.go プロジェクト: abieberbach/goplane
func UnregisterDrawCallback(callback DrawCallback, phase DrawingPhase, wantsBefore bool, ref interface{}) bool {
	var id *C.char
	for key, info := range callbacks {
		if info.funcPointerAsString == fmt.Sprint(callback) && info.ref == ref {
			id = key
			defer C.free(unsafe.Pointer(id))
		}
	}
	return C.XPLMUnregisterDrawCallback(C.XPLMDrawCallback_f(unsafe.Pointer(C.drawCallback)), C.XPLMDrawingPhase(phase), C.int(goplane.FromBoolToInt(wantsBefore)), unsafe.Pointer(id)) == 1
}
コード例 #2
0
ファイル: drawing.go プロジェクト: abieberbach/goplane
func RegisterDrawCallback(callback DrawCallback, phase DrawingPhase, wantsBefore bool, ref interface{}) bool {
	id := C.CString(goplane.IdGenerator())
	callbacks[id] = regData{fmt.Sprint(callback), callback, ref}
	return C.XPLMRegisterDrawCallback(C.XPLMDrawCallback_f(unsafe.Pointer(C.drawCallback)), C.XPLMDrawingPhase(phase), C.int(goplane.FromBoolToInt(wantsBefore)), unsafe.Pointer(id)) == 1
}