Ejemplo n.º 1
0
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
}
Ejemplo n.º 2
0
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
}