示例#1
0
func RegisterHotKey(key xplm.VirtualKeyCode, flags xplm.KeyFlags, description string, callback HotKeyCallback, ref interface{}) HotKeyID {
	cDescription := C.CString(description)
	defer C.free(unsafe.Pointer(cDescription))
	cId := C.CString(goplane.IdGenerator())
	regData := &hotKeyRegData{nil, callback, ref}
	hotkeys[cId] = regData
	hotkeyId := HotKeyID(C.XPLMRegisterHotKey(C.char(key), C.XPLMKeyFlags(flags), cDescription, C.XPLMHotKey_f(unsafe.Pointer(C.handleHotKey)), unsafe.Pointer(cId)))
	regData.id = hotkeyId
	return hotkeyId
}
示例#2
0
func SetHotKeyCombination(hotkeyId HotKeyID, virtualKey xplm.VirtualKeyCode, flags xplm.KeyFlags) {
	C.XPLMSetHotKeyCombination(C.XPLMHotKeyID(hotkeyId), C.char(virtualKey), C.XPLMKeyFlags(flags))
}