示例#1
0
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))
		}
	}
}
示例#2
0
func RegisterCommandHandler(command CommandRef, callback CommandCallback, before bool, ref interface{}) {
	cId := C.CString(goplane.IdGenerator())
	callbacks[cId] = &regInfo{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))
}
示例#3
0
func CommandEnd(command CommandRef) {
	C.XPLMCommandEnd(C.XPLMCommandRef(command))
}
示例#4
0
func CommandOnce(command CommandRef) {
	C.XPLMCommandOnce(C.XPLMCommandRef(command))
}
示例#5
0
func CommandBegin(command CommandRef) {
	C.XPLMCommandBegin(C.XPLMCommandRef(command))
}