func UnregisterCommandHandler(command CommandRef, callback CommandCallback, before bool, ref interface{}) { callbackAsString := fmt.Sprint(callback) for cId, regInfo := range callbacks { if regInfo.command == command && regInfo.callbackAsString == callbackAsString && regInfo.ref == ref { C.XPLMUnregisterCommandHandler(C.XPLMCommandRef(command), C.XPLMCommandCallback_f(unsafe.Pointer(C.commandCallback)), C.int(goplane.FromBoolToInt(before)), unsafe.Pointer(cId)) defer C.free(unsafe.Pointer(cId)) } } }
func RegisterCommandHandler(command CommandRef, callback CommandCallback, before bool, ref interface{}) { cId := C.CString(goplane.IdGenerator()) callbacks[cId] = ®Info{fmt.Sprint(callback), command, callback, ref} C.XPLMRegisterCommandHandler(C.XPLMCommandRef(command), C.XPLMCommandCallback_f(unsafe.Pointer(C.commandCallback)), C.int(goplane.FromBoolToInt(before)), unsafe.Pointer(cId)) }
func CommandEnd(command CommandRef) { C.XPLMCommandEnd(C.XPLMCommandRef(command)) }
func CommandOnce(command CommandRef) { C.XPLMCommandOnce(C.XPLMCommandRef(command)) }
func CommandBegin(command CommandRef) { C.XPLMCommandBegin(C.XPLMCommandRef(command)) }