mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
ebiten: Change the key name convention to follow the Web standard
Closes #1394
This commit is contained in:
parent
4c22314b3a
commit
4398a5e227
443
genkeys.go
443
genkeys.go
@ -14,10 +14,7 @@
|
|||||||
|
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Note:
|
// The key name convention follows the Web standard: https://www.w3.org/TR/uievents-code/#keyboard-key-codes
|
||||||
// * Respect GLFW key names
|
|
||||||
// * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.keyCode
|
|
||||||
// * It is best to replace keyCode with code, but many browsers don't implement it.
|
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@ -35,11 +32,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
glfwKeyNameToGLFWKey map[string]glfw.Key
|
glfwKeyNameToGLFWKey map[string]glfw.Key
|
||||||
androidKeyToDriverKeyName map[int]string
|
driverKeyNameToGLFWKeyName map[string]string
|
||||||
gbuildKeyToDriverKeyName map[key.Code]string
|
androidKeyToDriverKeyName map[int]string
|
||||||
driverKeyNameToJSKey map[string]string
|
gbuildKeyToDriverKeyName map[key.Code]string
|
||||||
edgeKeyCodeToName map[int]string
|
driverKeyNameToJSKey map[string]string
|
||||||
|
edgeKeyCodeToName map[int]string
|
||||||
|
oldEbitenKeyNameToDriverKeyName map[string]string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -97,17 +96,67 @@ func init() {
|
|||||||
"Last": glfw.KeyLast,
|
"Last": glfw.KeyLast,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
driverKeyNameToGLFWKeyName = map[string]string{
|
||||||
|
"Space": "Space",
|
||||||
|
"Quote": "Apostrophe",
|
||||||
|
"Comma": "Comma",
|
||||||
|
"Minus": "Minus",
|
||||||
|
"Period": "Period",
|
||||||
|
"Slash": "Slash",
|
||||||
|
"Semicolon": "Semicolon",
|
||||||
|
"Equal": "Equal",
|
||||||
|
"BracketLeft": "LeftBracket",
|
||||||
|
"Backslash": "Backslash",
|
||||||
|
"BracketRight": "RightBracket",
|
||||||
|
"Backquote": "GraveAccent",
|
||||||
|
"Escape": "Escape",
|
||||||
|
"Enter": "Enter",
|
||||||
|
"Tab": "Tab",
|
||||||
|
"Backspace": "Backspace",
|
||||||
|
"Insert": "Insert",
|
||||||
|
"Delete": "Delete",
|
||||||
|
"ArrowRight": "Right",
|
||||||
|
"ArrowLeft": "Left",
|
||||||
|
"ArrowDown": "Down",
|
||||||
|
"ArrowUp": "Up",
|
||||||
|
"PageUp": "PageUp",
|
||||||
|
"PageDown": "PageDown",
|
||||||
|
"Home": "Home",
|
||||||
|
"End": "End",
|
||||||
|
"CapsLock": "CapsLock",
|
||||||
|
"ScrollLock": "ScrollLock",
|
||||||
|
"NumLock": "NumLock",
|
||||||
|
"PrintScreen": "PrintScreen",
|
||||||
|
"Pause": "Pause",
|
||||||
|
"ShiftLeft": "LeftShift",
|
||||||
|
"ControlLeft": "LeftControl",
|
||||||
|
"AltLeft": "LeftAlt",
|
||||||
|
"MetaLeft": "LeftSuper",
|
||||||
|
"ShiftRight": "RightShift",
|
||||||
|
"ControlRight": "RightControl",
|
||||||
|
"AltRight": "RightAlt",
|
||||||
|
"MetaRight": "RightSuper",
|
||||||
|
"ContextMenu": "Menu",
|
||||||
|
"NumpadAdd": "KPAdd",
|
||||||
|
"NumpadDecimal": "KPDecimal",
|
||||||
|
"NumpadDivide": "KPDivide",
|
||||||
|
"NumpadMultiply": "KPMultiply",
|
||||||
|
"NumpadSubtract": "KPSubtract",
|
||||||
|
"NumpadEnter": "KPEnter",
|
||||||
|
"NumpadEqual": "KPEqual",
|
||||||
|
}
|
||||||
|
|
||||||
// https://developer.android.com/reference/android/view/KeyEvent
|
// https://developer.android.com/reference/android/view/KeyEvent
|
||||||
androidKeyToDriverKeyName = map[int]string{
|
androidKeyToDriverKeyName = map[int]string{
|
||||||
55: "Comma",
|
55: "Comma",
|
||||||
56: "Period",
|
56: "Period",
|
||||||
57: "LeftAlt",
|
57: "AltLeft",
|
||||||
58: "RightAlt",
|
58: "AltRight",
|
||||||
115: "CapsLock",
|
115: "CapsLock",
|
||||||
113: "LeftControl",
|
113: "ControlLeft",
|
||||||
114: "RightControl",
|
114: "ControlRight",
|
||||||
59: "LeftShift",
|
59: "ShiftLeft",
|
||||||
60: "RightShift",
|
60: "ShiftRight",
|
||||||
66: "Enter",
|
66: "Enter",
|
||||||
62: "Space",
|
62: "Space",
|
||||||
61: "Tab",
|
61: "Tab",
|
||||||
@ -117,47 +166,47 @@ func init() {
|
|||||||
124: "Insert",
|
124: "Insert",
|
||||||
93: "PageDown",
|
93: "PageDown",
|
||||||
92: "PageUp",
|
92: "PageUp",
|
||||||
20: "Down",
|
20: "ArrowDown",
|
||||||
21: "Left",
|
21: "ArrowLeft",
|
||||||
22: "Right",
|
22: "ArrowRight",
|
||||||
19: "Up",
|
19: "ArrowUp",
|
||||||
111: "Escape",
|
111: "Escape",
|
||||||
67: "Backspace", // KEYCODE_DEL
|
67: "Backspace", // KEYCODE_DEL
|
||||||
75: "Apostrophe",
|
75: "Quote",
|
||||||
69: "Minus",
|
69: "Minus",
|
||||||
76: "Slash",
|
76: "Slash",
|
||||||
74: "Semicolon",
|
74: "Semicolon",
|
||||||
70: "Equal",
|
70: "Equal",
|
||||||
71: "LeftBracket",
|
71: "BracketLeft",
|
||||||
73: "Backslash",
|
73: "Backslash",
|
||||||
72: "RightBracket",
|
72: "BracketRight",
|
||||||
68: "GraveAccent",
|
68: "Backquote",
|
||||||
143: "NumLock",
|
143: "NumLock",
|
||||||
121: "Pause", // KEYCODE_BREAK
|
121: "Pause", // KEYCODE_BREAK
|
||||||
120: "PrintScreen", // KEYCODE_SYSRQ
|
120: "PrintScreen", // KEYCODE_SYSRQ
|
||||||
116: "ScrollLock",
|
116: "ScrollLock",
|
||||||
82: "Menu",
|
82: "ContextMenu",
|
||||||
158: "KPDecimal",
|
157: "NumpadAdd",
|
||||||
154: "KPDivide",
|
158: "NumpadDecimal",
|
||||||
155: "KPMultiply",
|
154: "NumpadDivide",
|
||||||
156: "KPSubtract",
|
155: "NumpadMultiply",
|
||||||
157: "KPAdd",
|
156: "NumpadSubtract",
|
||||||
160: "KPEnter",
|
160: "NumpadEnter",
|
||||||
161: "KPEqual",
|
161: "NumpadEqual",
|
||||||
117: "LeftSuper", // KEYCODE_META_LEFT
|
117: "MetaLeft",
|
||||||
118: "RightSuper", // KEYCODE_META_RIGHT
|
118: "MetaRight",
|
||||||
}
|
}
|
||||||
|
|
||||||
gbuildKeyToDriverKeyName = map[key.Code]string{
|
gbuildKeyToDriverKeyName = map[key.Code]string{
|
||||||
key.CodeComma: "Comma",
|
key.CodeComma: "Comma",
|
||||||
key.CodeFullStop: "Period",
|
key.CodeFullStop: "Period",
|
||||||
key.CodeLeftAlt: "LeftAlt",
|
key.CodeLeftAlt: "AltLeft",
|
||||||
key.CodeRightAlt: "RightAlt",
|
key.CodeRightAlt: "AltRight",
|
||||||
key.CodeCapsLock: "CapsLock",
|
key.CodeCapsLock: "CapsLock",
|
||||||
key.CodeLeftControl: "LeftControl",
|
key.CodeLeftControl: "ControlLeft",
|
||||||
key.CodeRightControl: "RightControl",
|
key.CodeRightControl: "ControlRight",
|
||||||
key.CodeLeftShift: "LeftShift",
|
key.CodeLeftShift: "ShiftLeft",
|
||||||
key.CodeRightShift: "RightShift",
|
key.CodeRightShift: "ShiftRight",
|
||||||
key.CodeReturnEnter: "Enter",
|
key.CodeReturnEnter: "Enter",
|
||||||
key.CodeSpacebar: "Space",
|
key.CodeSpacebar: "Space",
|
||||||
key.CodeTab: "Tab",
|
key.CodeTab: "Tab",
|
||||||
@ -167,32 +216,32 @@ func init() {
|
|||||||
key.CodeInsert: "Insert",
|
key.CodeInsert: "Insert",
|
||||||
key.CodePageDown: "PageDown",
|
key.CodePageDown: "PageDown",
|
||||||
key.CodePageUp: "PageUp",
|
key.CodePageUp: "PageUp",
|
||||||
key.CodeDownArrow: "Down",
|
key.CodeDownArrow: "ArrowDown",
|
||||||
key.CodeLeftArrow: "Left",
|
key.CodeLeftArrow: "ArrowLeft",
|
||||||
key.CodeRightArrow: "Right",
|
key.CodeRightArrow: "ArrowRight",
|
||||||
key.CodeUpArrow: "Up",
|
key.CodeUpArrow: "ArrowUp",
|
||||||
key.CodeEscape: "Escape",
|
key.CodeEscape: "Escape",
|
||||||
key.CodeDeleteBackspace: "Backspace",
|
key.CodeDeleteBackspace: "Backspace",
|
||||||
key.CodeApostrophe: "Apostrophe",
|
key.CodeApostrophe: "Quote",
|
||||||
key.CodeHyphenMinus: "Minus",
|
key.CodeHyphenMinus: "Minus",
|
||||||
key.CodeSlash: "Slash",
|
key.CodeSlash: "Slash",
|
||||||
key.CodeSemicolon: "Semicolon",
|
key.CodeSemicolon: "Semicolon",
|
||||||
key.CodeEqualSign: "Equal",
|
key.CodeEqualSign: "Equal",
|
||||||
key.CodeLeftSquareBracket: "LeftBracket",
|
key.CodeLeftSquareBracket: "BracketLeft",
|
||||||
key.CodeBackslash: "Backslash",
|
key.CodeBackslash: "Backslash",
|
||||||
key.CodeRightSquareBracket: "RightBracket",
|
key.CodeRightSquareBracket: "BracketRight",
|
||||||
key.CodeGraveAccent: "GraveAccent",
|
key.CodeGraveAccent: "Backquote",
|
||||||
key.CodeKeypadNumLock: "NumLock",
|
key.CodeKeypadNumLock: "NumLock",
|
||||||
key.CodePause: "Pause",
|
key.CodePause: "Pause",
|
||||||
key.CodeKeypadFullStop: "KPDecimal",
|
key.CodeKeypadPlusSign: "NumpadAdd",
|
||||||
key.CodeKeypadSlash: "KPDivide",
|
key.CodeKeypadFullStop: "NumpadDecimal",
|
||||||
key.CodeKeypadAsterisk: "KPMultiply",
|
key.CodeKeypadSlash: "NumpadDivide",
|
||||||
key.CodeKeypadHyphenMinus: "KPSubtract",
|
key.CodeKeypadAsterisk: "NumpadMultiply",
|
||||||
key.CodeKeypadPlusSign: "KPAdd",
|
key.CodeKeypadHyphenMinus: "NumpadSubtract",
|
||||||
key.CodeKeypadEnter: "KPEnter",
|
key.CodeKeypadEnter: "NumpadEnter",
|
||||||
key.CodeKeypadEqualSign: "KPEqual",
|
key.CodeKeypadEqualSign: "NumpadEqual",
|
||||||
key.CodeLeftGUI: "LeftSuper",
|
key.CodeLeftGUI: "MetaLeft",
|
||||||
key.CodeRightGUI: "RightSuper",
|
key.CodeRightGUI: "MetaRight",
|
||||||
|
|
||||||
// Missing keys:
|
// Missing keys:
|
||||||
// driver.KeyPrintScreen
|
// driver.KeyPrintScreen
|
||||||
@ -200,72 +249,76 @@ func init() {
|
|||||||
// driver.KeyMenu
|
// driver.KeyMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The driver key and JS key are almost same but very slightly different (e.g., 'A' vs 'KeyA').
|
||||||
driverKeyNameToJSKey = map[string]string{
|
driverKeyNameToJSKey = map[string]string{
|
||||||
"Comma": "Comma",
|
"Comma": "Comma",
|
||||||
"Period": "Period",
|
"Period": "Period",
|
||||||
"LeftAlt": "AltLeft",
|
"AltLeft": "AltLeft",
|
||||||
"RightAlt": "AltRight",
|
"AltRight": "AltRight",
|
||||||
"CapsLock": "CapsLock",
|
"CapsLock": "CapsLock",
|
||||||
"LeftControl": "ControlLeft",
|
"ControlLeft": "ControlLeft",
|
||||||
"RightControl": "ControlRight",
|
"ControlRight": "ControlRight",
|
||||||
"LeftShift": "ShiftLeft",
|
"ShiftLeft": "ShiftLeft",
|
||||||
"RightShift": "ShiftRight",
|
"ShiftRight": "ShiftRight",
|
||||||
"Enter": "Enter",
|
"Enter": "Enter",
|
||||||
"Space": "Space",
|
"Space": "Space",
|
||||||
"Tab": "Tab",
|
"Tab": "Tab",
|
||||||
"Delete": "Delete",
|
"Delete": "Delete",
|
||||||
"End": "End",
|
"End": "End",
|
||||||
"Home": "Home",
|
"Home": "Home",
|
||||||
"Insert": "Insert",
|
"Insert": "Insert",
|
||||||
"PageDown": "PageDown",
|
"PageDown": "PageDown",
|
||||||
"PageUp": "PageUp",
|
"PageUp": "PageUp",
|
||||||
"Down": "ArrowDown",
|
"ArrowDown": "ArrowDown",
|
||||||
"Left": "ArrowLeft",
|
"ArrowLeft": "ArrowLeft",
|
||||||
"Right": "ArrowRight",
|
"ArrowRight": "ArrowRight",
|
||||||
"Up": "ArrowUp",
|
"ArrowUp": "ArrowUp",
|
||||||
"Escape": "Escape",
|
"Escape": "Escape",
|
||||||
"Backspace": "Backspace",
|
"Backspace": "Backspace",
|
||||||
"Apostrophe": "Quote",
|
"Quote": "Quote",
|
||||||
"Minus": "Minus",
|
"Minus": "Minus",
|
||||||
"Slash": "Slash",
|
"Slash": "Slash",
|
||||||
"Semicolon": "Semicolon",
|
"Semicolon": "Semicolon",
|
||||||
"Equal": "Equal",
|
"Equal": "Equal",
|
||||||
"LeftBracket": "BracketLeft",
|
"BracketLeft": "BracketLeft",
|
||||||
"Backslash": "Backslash",
|
"Backslash": "Backslash",
|
||||||
"RightBracket": "BracketRight",
|
"BracketRight": "BracketRight",
|
||||||
"GraveAccent": "Backquote",
|
"Backquote": "Backquote",
|
||||||
"NumLock": "NumLock",
|
"NumLock": "NumLock",
|
||||||
"Pause": "Pause",
|
"Pause": "Pause",
|
||||||
"PrintScreen": "PrintScreen",
|
"PrintScreen": "PrintScreen",
|
||||||
"ScrollLock": "ScrollLock",
|
"ScrollLock": "ScrollLock",
|
||||||
"Menu": "ContextMenu",
|
"ContextMenu": "ContextMenu",
|
||||||
"KPDecimal": "NumpadDecimal",
|
"NumpadAdd": "NumpadAdd",
|
||||||
"KPDivide": "NumpadDivide",
|
"NumpadDecimal": "NumpadDecimal",
|
||||||
"KPMultiply": "NumpadMultiply",
|
"NumpadDivide": "NumpadDivide",
|
||||||
"KPSubtract": "NumpadSubtract",
|
"NumpadMultiply": "NumpadMultiply",
|
||||||
"KPAdd": "NumpadAdd",
|
"NumpadSubtract": "NumpadSubtract",
|
||||||
"KPEnter": "NumpadEnter",
|
"NumpadEnter": "NumpadEnter",
|
||||||
"KPEqual": "NumpadEqual",
|
"NumpadEqual": "NumpadEqual",
|
||||||
"LeftSuper": "MetaLeft",
|
"MetaLeft": "MetaLeft",
|
||||||
"RightSuper": "MetaRight",
|
"MetaRight": "MetaRight",
|
||||||
}
|
}
|
||||||
|
|
||||||
// ASCII: 0 - 9
|
// ASCII: 0 - 9
|
||||||
for c := '0'; c <= '9'; c++ {
|
for c := '0'; c <= '9'; c++ {
|
||||||
glfwKeyNameToGLFWKey[string(c)] = glfw.Key0 + glfw.Key(c) - '0'
|
glfwKeyNameToGLFWKey[string(c)] = glfw.Key0 + glfw.Key(c) - '0'
|
||||||
androidKeyToDriverKeyName[7+int(c)-'0'] = string(c)
|
name := "Digit" + string(c)
|
||||||
|
driverKeyNameToGLFWKeyName[name] = string(c)
|
||||||
|
androidKeyToDriverKeyName[7+int(c)-'0'] = name
|
||||||
// Gomobile's key code (= USB HID key codes) has successive key codes for 1, 2, ..., 9, 0
|
// Gomobile's key code (= USB HID key codes) has successive key codes for 1, 2, ..., 9, 0
|
||||||
// in this order.
|
// in this order.
|
||||||
if c == '0' {
|
if c == '0' {
|
||||||
gbuildKeyToDriverKeyName[key.Code0] = string(c)
|
gbuildKeyToDriverKeyName[key.Code0] = name
|
||||||
} else {
|
} else {
|
||||||
gbuildKeyToDriverKeyName[key.Code1+key.Code(c)-'1'] = string(c)
|
gbuildKeyToDriverKeyName[key.Code1+key.Code(c)-'1'] = name
|
||||||
}
|
}
|
||||||
driverKeyNameToJSKey[string(c)] = "Digit" + string(c)
|
driverKeyNameToJSKey[name] = name
|
||||||
}
|
}
|
||||||
// ASCII: A - Z
|
// ASCII: A - Z
|
||||||
for c := 'A'; c <= 'Z'; c++ {
|
for c := 'A'; c <= 'Z'; c++ {
|
||||||
glfwKeyNameToGLFWKey[string(c)] = glfw.KeyA + glfw.Key(c) - 'A'
|
glfwKeyNameToGLFWKey[string(c)] = glfw.KeyA + glfw.Key(c) - 'A'
|
||||||
|
driverKeyNameToGLFWKeyName[string(c)] = string(c)
|
||||||
androidKeyToDriverKeyName[29+int(c)-'A'] = string(c)
|
androidKeyToDriverKeyName[29+int(c)-'A'] = string(c)
|
||||||
gbuildKeyToDriverKeyName[key.CodeA+key.Code(c)-'A'] = string(c)
|
gbuildKeyToDriverKeyName[key.CodeA+key.Code(c)-'A'] = string(c)
|
||||||
driverKeyNameToJSKey[string(c)] = "Key" + string(c)
|
driverKeyNameToJSKey[string(c)] = "Key" + string(c)
|
||||||
@ -274,6 +327,7 @@ func init() {
|
|||||||
for i := 1; i <= 12; i++ {
|
for i := 1; i <= 12; i++ {
|
||||||
name := "F" + strconv.Itoa(i)
|
name := "F" + strconv.Itoa(i)
|
||||||
glfwKeyNameToGLFWKey[name] = glfw.KeyF1 + glfw.Key(i) - 1
|
glfwKeyNameToGLFWKey[name] = glfw.KeyF1 + glfw.Key(i) - 1
|
||||||
|
driverKeyNameToGLFWKeyName[name] = name
|
||||||
androidKeyToDriverKeyName[131+i-1] = name
|
androidKeyToDriverKeyName[131+i-1] = name
|
||||||
gbuildKeyToDriverKeyName[key.CodeF1+key.Code(i)-1] = name
|
gbuildKeyToDriverKeyName[key.CodeF1+key.Code(i)-1] = name
|
||||||
driverKeyNameToJSKey[name] = name
|
driverKeyNameToJSKey[name] = name
|
||||||
@ -281,8 +335,9 @@ func init() {
|
|||||||
// Numpad
|
// Numpad
|
||||||
// https://www.w3.org/TR/uievents-code/#key-numpad-section
|
// https://www.w3.org/TR/uievents-code/#key-numpad-section
|
||||||
for c := '0'; c <= '9'; c++ {
|
for c := '0'; c <= '9'; c++ {
|
||||||
name := "KP" + string(c)
|
name := "Numpad" + string(c)
|
||||||
glfwKeyNameToGLFWKey[name] = glfw.KeyKP0 + glfw.Key(c) - '0'
|
glfwKeyNameToGLFWKey["KP"+string(c)] = glfw.KeyKP0 + glfw.Key(c) - '0'
|
||||||
|
driverKeyNameToGLFWKeyName[name] = "KP" + string(c)
|
||||||
androidKeyToDriverKeyName[144+int(c)-'0'] = name
|
androidKeyToDriverKeyName[144+int(c)-'0'] = name
|
||||||
// Gomobile's key code (= USB HID key codes) has successive key codes for 1, 2, ..., 9, 0
|
// Gomobile's key code (= USB HID key codes) has successive key codes for 1, 2, ..., 9, 0
|
||||||
// in this order.
|
// in this order.
|
||||||
@ -291,7 +346,46 @@ func init() {
|
|||||||
} else {
|
} else {
|
||||||
gbuildKeyToDriverKeyName[key.CodeKeypad1+key.Code(c)-'1'] = name
|
gbuildKeyToDriverKeyName[key.CodeKeypad1+key.Code(c)-'1'] = name
|
||||||
}
|
}
|
||||||
driverKeyNameToJSKey[name] = "Numpad" + string(c)
|
driverKeyNameToJSKey[name] = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keys for backward compatibility
|
||||||
|
oldEbitenKeyNameToDriverKeyName = map[string]string{
|
||||||
|
"0": "Digit0",
|
||||||
|
"1": "Digit1",
|
||||||
|
"2": "Digit2",
|
||||||
|
"3": "Digit3",
|
||||||
|
"4": "Digit4",
|
||||||
|
"5": "Digit5",
|
||||||
|
"6": "Digit6",
|
||||||
|
"7": "Digit7",
|
||||||
|
"8": "Digit8",
|
||||||
|
"9": "Digit9",
|
||||||
|
"Apostrophe": "Quote",
|
||||||
|
"Down": "ArrowDown",
|
||||||
|
"GraveAccent": "Backquote",
|
||||||
|
"KP0": "Numpad0",
|
||||||
|
"KP1": "Numpad1",
|
||||||
|
"KP2": "Numpad2",
|
||||||
|
"KP3": "Numpad3",
|
||||||
|
"KP4": "Numpad4",
|
||||||
|
"KP5": "Numpad5",
|
||||||
|
"KP6": "Numpad6",
|
||||||
|
"KP7": "Numpad7",
|
||||||
|
"KP8": "Numpad8",
|
||||||
|
"KP9": "Numpad9",
|
||||||
|
"KPDecimal": "NumpadDecimal",
|
||||||
|
"KPDivide": "NumpadDivide",
|
||||||
|
"KPMultiply": "NumpadMultiply",
|
||||||
|
"KPSubtract": "NumpadSubtract",
|
||||||
|
"KPEnter": "NumpadEnter",
|
||||||
|
"KPEqual": "NumpadEqual",
|
||||||
|
"Left": "ArrowLeft",
|
||||||
|
"LeftBracket": "BracketLeft",
|
||||||
|
"Menu": "ContextMenu",
|
||||||
|
"Right": "ArrowRight",
|
||||||
|
"RightBracket": "BracketRight",
|
||||||
|
"Up": "ArrowUp",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,10 +395,10 @@ func init() {
|
|||||||
edgeKeyCodeToName = map[int]string{
|
edgeKeyCodeToName = map[int]string{
|
||||||
0xbc: "Comma",
|
0xbc: "Comma",
|
||||||
0xbe: "Period",
|
0xbe: "Period",
|
||||||
0x12: "LeftAlt",
|
0x12: "AltLeft",
|
||||||
0x14: "CapsLock",
|
0x14: "CapsLock",
|
||||||
0x11: "LeftControl",
|
0x11: "ControlLeft",
|
||||||
0x10: "LeftShift",
|
0x10: "ShiftLeft",
|
||||||
0x0D: "Enter",
|
0x0D: "Enter",
|
||||||
0x20: "Space",
|
0x20: "Space",
|
||||||
0x09: "Tab",
|
0x09: "Tab",
|
||||||
@ -314,43 +408,43 @@ func init() {
|
|||||||
0x2D: "Insert",
|
0x2D: "Insert",
|
||||||
0x22: "PageDown",
|
0x22: "PageDown",
|
||||||
0x21: "PageUp",
|
0x21: "PageUp",
|
||||||
0x28: "Down",
|
0x28: "ArrowDown",
|
||||||
0x25: "Left",
|
0x25: "ArrowLeft",
|
||||||
0x27: "Right",
|
0x27: "ArrowRight",
|
||||||
0x26: "Up",
|
0x26: "ArrowUp",
|
||||||
0x1B: "Escape",
|
0x1B: "Escape",
|
||||||
0xde: "Apostrophe",
|
0xde: "Quote",
|
||||||
0xbd: "Minus",
|
0xbd: "Minus",
|
||||||
0xbf: "Slash",
|
0xbf: "Slash",
|
||||||
0xba: "Semicolon",
|
0xba: "Semicolon",
|
||||||
0xbb: "Equal",
|
0xbb: "Equal",
|
||||||
0xdb: "LeftBracket",
|
0xdb: "BracketLeft",
|
||||||
0xdc: "Backslash",
|
0xdc: "Backslash",
|
||||||
0xdd: "RightBracket",
|
0xdd: "BracketRight",
|
||||||
0xc0: "GraveAccent",
|
0xc0: "Backquote",
|
||||||
0x08: "Backspace",
|
0x08: "Backspace",
|
||||||
0x90: "NumLock",
|
0x90: "NumLock",
|
||||||
0x6e: "KPDecimal",
|
0x6b: "NumpadAdd",
|
||||||
0x6f: "KPDivide",
|
0x6e: "NumpadDecimal",
|
||||||
0x6a: "KPMultiply",
|
0x6f: "NumpadDivide",
|
||||||
0x6d: "KPSubtract",
|
0x6a: "NumpadMultiply",
|
||||||
0x6b: "KPAdd",
|
0x6d: "NumpadSubtract",
|
||||||
0x13: "Pause",
|
0x13: "Pause",
|
||||||
0x91: "ScrollLock",
|
0x91: "ScrollLock",
|
||||||
0x5d: "Menu",
|
0x5d: "ContextMenu",
|
||||||
0x5b: "LeftSuper",
|
0x5b: "MetaLeft",
|
||||||
0x5c: "RightSuper",
|
0x5c: "MetaRight",
|
||||||
|
|
||||||
// On Edge, this key does not work. PrintScreen works only on keyup event.
|
// On Edge, this key does not work. PrintScreen works only on keyup event.
|
||||||
// 0x2C: "PrintScreen",
|
// 0x2C: "PrintScreen",
|
||||||
|
|
||||||
// On Edge, it is impossible to tell KPEnter and Enter / KPEqual and Equal.
|
// On Edge, it is impossible to tell NumpadEnter and Enter / NumpadEqual and Equal.
|
||||||
// 0x0d: "KPEnter",
|
// 0x0d: "NumpadEnter",
|
||||||
// 0x0c: "KPEqual",
|
// 0x0c: "NumpadEqual",
|
||||||
}
|
}
|
||||||
// ASCII: 0 - 9
|
// ASCII: 0 - 9
|
||||||
for c := '0'; c <= '9'; c++ {
|
for c := '0'; c <= '9'; c++ {
|
||||||
edgeKeyCodeToName[int(c)] = string(c)
|
edgeKeyCodeToName[int(c)] = "Digit" + string(c)
|
||||||
}
|
}
|
||||||
// ASCII: A - Z
|
// ASCII: A - Z
|
||||||
for c := 'A'; c <= 'Z'; c++ {
|
for c := 'A'; c <= 'Z'; c++ {
|
||||||
@ -362,7 +456,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
// Numpad keys
|
// Numpad keys
|
||||||
for c := '0'; c <= '9'; c++ {
|
for c := '0'; c <= '9'; c++ {
|
||||||
edgeKeyCodeToName[0x60+int(c-'0')] = "KP" + string(c)
|
edgeKeyCodeToName[0x60+int(c-'0')] = "Numpad" + string(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,16 +480,21 @@ type Key int
|
|||||||
// Keys.
|
// Keys.
|
||||||
const (
|
const (
|
||||||
{{range $index, $name := .EbitenKeyNamesWithoutMods}}Key{{$name}} Key = Key(driver.Key{{$name}})
|
{{range $index, $name := .EbitenKeyNamesWithoutMods}}Key{{$name}} Key = Key(driver.Key{{$name}})
|
||||||
{{end}} KeyAlt Key = Key(driver.KeyReserved0)
|
{{end}} KeyAlt Key = Key(driver.KeyReserved0)
|
||||||
KeyControl Key = Key(driver.KeyReserved1)
|
KeyControl Key = Key(driver.KeyReserved1)
|
||||||
KeyShift Key = Key(driver.KeyReserved2)
|
KeyShift Key = Key(driver.KeyReserved2)
|
||||||
KeySuper Key = Key(driver.KeyReserved3)
|
KeyMeta Key = Key(driver.KeyReserved3)
|
||||||
KeyMax Key = KeySuper
|
KeyMax Key = KeyMeta
|
||||||
|
|
||||||
|
// Keys for backward compatibility.
|
||||||
|
// Deprecated: as of 2.1.0.
|
||||||
|
{{range $old, $new := .OldEbitenKeyNameToDriverKeyName}}Key{{$old}} Key = Key(driver.Key{{$new}})
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (k Key) isValid() bool {
|
func (k Key) isValid() bool {
|
||||||
switch k {
|
switch k {
|
||||||
{{range $name := .EbitenKeyNames}}case Key{{$name}}:
|
{{range $name := .EbitenKeyNamesWithoutOld}}case Key{{$name}}:
|
||||||
return true
|
return true
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
default:
|
||||||
@ -408,7 +507,7 @@ func (k Key) isValid() bool {
|
|||||||
// If k is an undefined key, String returns an empty string.
|
// If k is an undefined key, String returns an empty string.
|
||||||
func (k Key) String() string {
|
func (k Key) String() string {
|
||||||
switch k {
|
switch k {
|
||||||
{{range $name := .EbitenKeyNames}}case Key{{$name}}:
|
{{range $name := .EbitenKeyNamesWithoutOld}}case Key{{$name}}:
|
||||||
return {{$name | printf "%q"}}
|
return {{$name | printf "%q"}}
|
||||||
{{end}}}
|
{{end}}}
|
||||||
return ""
|
return ""
|
||||||
@ -484,12 +583,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var glfwKeyToDriverKey = map[glfw.Key]driver.Key{
|
var glfwKeyToDriverKey = map[glfw.Key]driver.Key{
|
||||||
{{range $index, $name := .DriverKeyNames}}glfw.Key{{$name}}: driver.Key{{$name}},
|
{{range $dname, $gname := .DriverKeyNameToGLFWKeyName}}glfw.Key{{$gname}}: driver.Key{{$dname}},
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
var driverKeyToGLFWKey = map[driver.Key]glfw.Key{
|
var driverKeyToGLFWKey = map[driver.Key]glfw.Key{
|
||||||
{{range $index, $name := .DriverKeyNames}}driver.Key{{$name}}: glfw.Key{{$name}},
|
{{range $dname, $gname := .DriverKeyNameToGLFWKeyName}}driver.Key{{$dname}}: glfw.Key{{$gname}},
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
@ -661,17 +760,25 @@ func main() {
|
|||||||
doNotEdit := "// Code generated by genkeys.go using 'go generate'. DO NOT EDIT."
|
doNotEdit := "// Code generated by genkeys.go using 'go generate'. DO NOT EDIT."
|
||||||
|
|
||||||
ebitenKeyNames := []string{}
|
ebitenKeyNames := []string{}
|
||||||
|
ebitenKeyNamesWithoutOld := []string{}
|
||||||
ebitenKeyNamesWithoutMods := []string{}
|
ebitenKeyNamesWithoutMods := []string{}
|
||||||
driverKeyNames := []string{}
|
driverKeyNames := []string{}
|
||||||
|
|
||||||
for name := range driverKeyNameToJSKey {
|
for name := range driverKeyNameToJSKey {
|
||||||
driverKeyNames = append(driverKeyNames, name)
|
driverKeyNames = append(driverKeyNames, name)
|
||||||
ebitenKeyNames = append(ebitenKeyNames, name)
|
ebitenKeyNames = append(ebitenKeyNames, name)
|
||||||
|
ebitenKeyNamesWithoutOld = append(ebitenKeyNamesWithoutOld, name)
|
||||||
ebitenKeyNamesWithoutMods = append(ebitenKeyNamesWithoutMods, name)
|
ebitenKeyNamesWithoutMods = append(ebitenKeyNamesWithoutMods, name)
|
||||||
}
|
}
|
||||||
ebitenKeyNames = append(ebitenKeyNames, "Alt", "Control", "Shift", "Super")
|
for old := range oldEbitenKeyNameToDriverKeyName {
|
||||||
|
ebitenKeyNames = append(ebitenKeyNames, old)
|
||||||
|
}
|
||||||
|
// Keys for modifiers
|
||||||
|
ebitenKeyNames = append(ebitenKeyNames, "Alt", "Control", "Shift", "Meta")
|
||||||
|
ebitenKeyNamesWithoutOld = append(ebitenKeyNamesWithoutOld, "Alt", "Control", "Shift", "Meta")
|
||||||
|
|
||||||
sort.Slice(ebitenKeyNames, keyNamesLess(ebitenKeyNames))
|
sort.Slice(ebitenKeyNames, keyNamesLess(ebitenKeyNames))
|
||||||
|
sort.Slice(ebitenKeyNamesWithoutOld, keyNamesLess(ebitenKeyNamesWithoutOld))
|
||||||
sort.Slice(ebitenKeyNamesWithoutMods, keyNamesLess(ebitenKeyNamesWithoutMods))
|
sort.Slice(ebitenKeyNamesWithoutMods, keyNamesLess(ebitenKeyNamesWithoutMods))
|
||||||
sort.Slice(driverKeyNames, keyNamesLess(driverKeyNames))
|
sort.Slice(driverKeyNames, keyNamesLess(driverKeyNames))
|
||||||
|
|
||||||
@ -715,29 +822,35 @@ func main() {
|
|||||||
}
|
}
|
||||||
// NOTE: According to godoc, maps are automatically sorted by key.
|
// NOTE: According to godoc, maps are automatically sorted by key.
|
||||||
if err := tmpl.Execute(f, struct {
|
if err := tmpl.Execute(f, struct {
|
||||||
License string
|
License string
|
||||||
DoNotEdit string
|
DoNotEdit string
|
||||||
BuildTag string
|
BuildTag string
|
||||||
DriverKeyNameToJSKey map[string]string
|
DriverKeyNameToJSKey map[string]string
|
||||||
EdgeKeyCodeToName map[int]string
|
EdgeKeyCodeToName map[int]string
|
||||||
EbitenKeyNames []string
|
EbitenKeyNames []string
|
||||||
EbitenKeyNamesWithoutMods []string
|
EbitenKeyNamesWithoutOld []string
|
||||||
DriverKeyNames []string
|
EbitenKeyNamesWithoutMods []string
|
||||||
GLFWKeyNameToGLFWKey map[string]glfw.Key
|
GLFWKeyNameToGLFWKey map[string]glfw.Key
|
||||||
AndroidKeyToDriverKeyName map[int]string
|
DriverKeyNames []string
|
||||||
GBuildKeyToDriverKeyName map[key.Code]string
|
DriverKeyNameToGLFWKeyName map[string]string
|
||||||
|
AndroidKeyToDriverKeyName map[int]string
|
||||||
|
GBuildKeyToDriverKeyName map[key.Code]string
|
||||||
|
OldEbitenKeyNameToDriverKeyName map[string]string
|
||||||
}{
|
}{
|
||||||
License: license,
|
License: license,
|
||||||
DoNotEdit: doNotEdit,
|
DoNotEdit: doNotEdit,
|
||||||
BuildTag: buildTag,
|
BuildTag: buildTag,
|
||||||
DriverKeyNameToJSKey: driverKeyNameToJSKey,
|
DriverKeyNameToJSKey: driverKeyNameToJSKey,
|
||||||
EdgeKeyCodeToName: edgeKeyCodeToName,
|
EdgeKeyCodeToName: edgeKeyCodeToName,
|
||||||
EbitenKeyNames: ebitenKeyNames,
|
EbitenKeyNames: ebitenKeyNames,
|
||||||
EbitenKeyNamesWithoutMods: ebitenKeyNamesWithoutMods,
|
EbitenKeyNamesWithoutOld: ebitenKeyNamesWithoutOld,
|
||||||
DriverKeyNames: driverKeyNames,
|
EbitenKeyNamesWithoutMods: ebitenKeyNamesWithoutMods,
|
||||||
GLFWKeyNameToGLFWKey: glfwKeyNameToGLFWKey,
|
GLFWKeyNameToGLFWKey: glfwKeyNameToGLFWKey,
|
||||||
AndroidKeyToDriverKeyName: androidKeyToDriverKeyName,
|
DriverKeyNames: driverKeyNames,
|
||||||
GBuildKeyToDriverKeyName: gbuildKeyToDriverKeyName,
|
DriverKeyNameToGLFWKeyName: driverKeyNameToGLFWKeyName,
|
||||||
|
AndroidKeyToDriverKeyName: androidKeyToDriverKeyName,
|
||||||
|
GBuildKeyToDriverKeyName: gbuildKeyToDriverKeyName,
|
||||||
|
OldEbitenKeyNameToDriverKeyName: oldEbitenKeyNameToDriverKeyName,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
10
input.go
10
input.go
@ -58,13 +58,13 @@ func IsKeyPressed(key Key) bool {
|
|||||||
var keys []driver.Key
|
var keys []driver.Key
|
||||||
switch key {
|
switch key {
|
||||||
case KeyAlt:
|
case KeyAlt:
|
||||||
keys = []driver.Key{driver.KeyLeftAlt, driver.KeyRightAlt}
|
keys = []driver.Key{driver.KeyAltLeft, driver.KeyAltRight}
|
||||||
case KeyControl:
|
case KeyControl:
|
||||||
keys = []driver.Key{driver.KeyLeftControl, driver.KeyRightControl}
|
keys = []driver.Key{driver.KeyControlLeft, driver.KeyControlRight}
|
||||||
case KeyShift:
|
case KeyShift:
|
||||||
keys = []driver.Key{driver.KeyLeftShift, driver.KeyRightShift}
|
keys = []driver.Key{driver.KeyShiftLeft, driver.KeyShiftRight}
|
||||||
case KeySuper:
|
case KeyMeta:
|
||||||
keys = []driver.Key{driver.KeyLeftSuper, driver.KeyRightSuper}
|
keys = []driver.Key{driver.KeyMetaLeft, driver.KeyMetaRight}
|
||||||
default:
|
default:
|
||||||
keys = []driver.Key{driver.Key(key)}
|
keys = []driver.Key{driver.Key(key)}
|
||||||
}
|
}
|
||||||
|
@ -23,17 +23,7 @@ import (
|
|||||||
type Key int
|
type Key int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Key0 Key = iota
|
KeyA Key = iota
|
||||||
Key1
|
|
||||||
Key2
|
|
||||||
Key3
|
|
||||||
Key4
|
|
||||||
Key5
|
|
||||||
Key6
|
|
||||||
Key7
|
|
||||||
Key8
|
|
||||||
Key9
|
|
||||||
KeyA
|
|
||||||
KeyB
|
KeyB
|
||||||
KeyC
|
KeyC
|
||||||
KeyD
|
KeyD
|
||||||
@ -59,13 +49,33 @@ const (
|
|||||||
KeyX
|
KeyX
|
||||||
KeyY
|
KeyY
|
||||||
KeyZ
|
KeyZ
|
||||||
KeyApostrophe
|
KeyAltLeft
|
||||||
|
KeyAltRight
|
||||||
|
KeyArrowDown
|
||||||
|
KeyArrowLeft
|
||||||
|
KeyArrowRight
|
||||||
|
KeyArrowUp
|
||||||
|
KeyBackquote
|
||||||
KeyBackslash
|
KeyBackslash
|
||||||
KeyBackspace
|
KeyBackspace
|
||||||
|
KeyBracketLeft
|
||||||
|
KeyBracketRight
|
||||||
KeyCapsLock
|
KeyCapsLock
|
||||||
KeyComma
|
KeyComma
|
||||||
|
KeyContextMenu
|
||||||
|
KeyControlLeft
|
||||||
|
KeyControlRight
|
||||||
KeyDelete
|
KeyDelete
|
||||||
KeyDown
|
KeyDigit0
|
||||||
|
KeyDigit1
|
||||||
|
KeyDigit2
|
||||||
|
KeyDigit3
|
||||||
|
KeyDigit4
|
||||||
|
KeyDigit5
|
||||||
|
KeyDigit6
|
||||||
|
KeyDigit7
|
||||||
|
KeyDigit8
|
||||||
|
KeyDigit9
|
||||||
KeyEnd
|
KeyEnd
|
||||||
KeyEnter
|
KeyEnter
|
||||||
KeyEqual
|
KeyEqual
|
||||||
@ -82,52 +92,42 @@ const (
|
|||||||
KeyF10
|
KeyF10
|
||||||
KeyF11
|
KeyF11
|
||||||
KeyF12
|
KeyF12
|
||||||
KeyGraveAccent
|
|
||||||
KeyHome
|
KeyHome
|
||||||
KeyInsert
|
KeyInsert
|
||||||
KeyKP0
|
KeyMetaLeft
|
||||||
KeyKP1
|
KeyMetaRight
|
||||||
KeyKP2
|
|
||||||
KeyKP3
|
|
||||||
KeyKP4
|
|
||||||
KeyKP5
|
|
||||||
KeyKP6
|
|
||||||
KeyKP7
|
|
||||||
KeyKP8
|
|
||||||
KeyKP9
|
|
||||||
KeyKPAdd
|
|
||||||
KeyKPDecimal
|
|
||||||
KeyKPDivide
|
|
||||||
KeyKPEnter
|
|
||||||
KeyKPEqual
|
|
||||||
KeyKPMultiply
|
|
||||||
KeyKPSubtract
|
|
||||||
KeyLeft
|
|
||||||
KeyLeftAlt
|
|
||||||
KeyLeftBracket
|
|
||||||
KeyLeftControl
|
|
||||||
KeyLeftShift
|
|
||||||
KeyLeftSuper
|
|
||||||
KeyMenu
|
|
||||||
KeyMinus
|
KeyMinus
|
||||||
KeyNumLock
|
KeyNumLock
|
||||||
|
KeyNumpad0
|
||||||
|
KeyNumpad1
|
||||||
|
KeyNumpad2
|
||||||
|
KeyNumpad3
|
||||||
|
KeyNumpad4
|
||||||
|
KeyNumpad5
|
||||||
|
KeyNumpad6
|
||||||
|
KeyNumpad7
|
||||||
|
KeyNumpad8
|
||||||
|
KeyNumpad9
|
||||||
|
KeyNumpadAdd
|
||||||
|
KeyNumpadDecimal
|
||||||
|
KeyNumpadDivide
|
||||||
|
KeyNumpadEnter
|
||||||
|
KeyNumpadEqual
|
||||||
|
KeyNumpadMultiply
|
||||||
|
KeyNumpadSubtract
|
||||||
KeyPageDown
|
KeyPageDown
|
||||||
KeyPageUp
|
KeyPageUp
|
||||||
KeyPause
|
KeyPause
|
||||||
KeyPeriod
|
KeyPeriod
|
||||||
KeyPrintScreen
|
KeyPrintScreen
|
||||||
KeyRight
|
KeyQuote
|
||||||
KeyRightAlt
|
|
||||||
KeyRightBracket
|
|
||||||
KeyRightControl
|
|
||||||
KeyRightShift
|
|
||||||
KeyRightSuper
|
|
||||||
KeyScrollLock
|
KeyScrollLock
|
||||||
KeySemicolon
|
KeySemicolon
|
||||||
|
KeyShiftLeft
|
||||||
|
KeyShiftRight
|
||||||
KeySlash
|
KeySlash
|
||||||
KeySpace
|
KeySpace
|
||||||
KeyTab
|
KeyTab
|
||||||
KeyUp
|
|
||||||
KeyReserved0
|
KeyReserved0
|
||||||
KeyReserved1
|
KeyReserved1
|
||||||
KeyReserved2
|
KeyReserved2
|
||||||
@ -136,26 +136,6 @@ const (
|
|||||||
|
|
||||||
func (k Key) String() string {
|
func (k Key) String() string {
|
||||||
switch k {
|
switch k {
|
||||||
case Key0:
|
|
||||||
return "Key0"
|
|
||||||
case Key1:
|
|
||||||
return "Key1"
|
|
||||||
case Key2:
|
|
||||||
return "Key2"
|
|
||||||
case Key3:
|
|
||||||
return "Key3"
|
|
||||||
case Key4:
|
|
||||||
return "Key4"
|
|
||||||
case Key5:
|
|
||||||
return "Key5"
|
|
||||||
case Key6:
|
|
||||||
return "Key6"
|
|
||||||
case Key7:
|
|
||||||
return "Key7"
|
|
||||||
case Key8:
|
|
||||||
return "Key8"
|
|
||||||
case Key9:
|
|
||||||
return "Key9"
|
|
||||||
case KeyA:
|
case KeyA:
|
||||||
return "KeyA"
|
return "KeyA"
|
||||||
case KeyB:
|
case KeyB:
|
||||||
@ -208,20 +188,60 @@ func (k Key) String() string {
|
|||||||
return "KeyY"
|
return "KeyY"
|
||||||
case KeyZ:
|
case KeyZ:
|
||||||
return "KeyZ"
|
return "KeyZ"
|
||||||
case KeyApostrophe:
|
case KeyAltLeft:
|
||||||
return "KeyApostrophe"
|
return "KeyAltLeft"
|
||||||
|
case KeyAltRight:
|
||||||
|
return "KeyAltRight"
|
||||||
|
case KeyArrowDown:
|
||||||
|
return "KeyArrowDown"
|
||||||
|
case KeyArrowLeft:
|
||||||
|
return "KeyArrowLeft"
|
||||||
|
case KeyArrowRight:
|
||||||
|
return "KeyArrowRight"
|
||||||
|
case KeyArrowUp:
|
||||||
|
return "KeyArrowUp"
|
||||||
|
case KeyBackquote:
|
||||||
|
return "KeyBackquote"
|
||||||
case KeyBackslash:
|
case KeyBackslash:
|
||||||
return "KeyBackslash"
|
return "KeyBackslash"
|
||||||
case KeyBackspace:
|
case KeyBackspace:
|
||||||
return "KeyBackspace"
|
return "KeyBackspace"
|
||||||
|
case KeyBracketLeft:
|
||||||
|
return "KeyBracketLeft"
|
||||||
|
case KeyBracketRight:
|
||||||
|
return "KeyBracketRight"
|
||||||
case KeyCapsLock:
|
case KeyCapsLock:
|
||||||
return "KeyCapsLock"
|
return "KeyCapsLock"
|
||||||
case KeyComma:
|
case KeyComma:
|
||||||
return "KeyComma"
|
return "KeyComma"
|
||||||
|
case KeyContextMenu:
|
||||||
|
return "KeyContextMenu"
|
||||||
|
case KeyControlLeft:
|
||||||
|
return "KeyControlLeft"
|
||||||
|
case KeyControlRight:
|
||||||
|
return "KeyControlRight"
|
||||||
case KeyDelete:
|
case KeyDelete:
|
||||||
return "KeyDelete"
|
return "KeyDelete"
|
||||||
case KeyDown:
|
case KeyDigit0:
|
||||||
return "KeyDown"
|
return "KeyDigit0"
|
||||||
|
case KeyDigit1:
|
||||||
|
return "KeyDigit1"
|
||||||
|
case KeyDigit2:
|
||||||
|
return "KeyDigit2"
|
||||||
|
case KeyDigit3:
|
||||||
|
return "KeyDigit3"
|
||||||
|
case KeyDigit4:
|
||||||
|
return "KeyDigit4"
|
||||||
|
case KeyDigit5:
|
||||||
|
return "KeyDigit5"
|
||||||
|
case KeyDigit6:
|
||||||
|
return "KeyDigit6"
|
||||||
|
case KeyDigit7:
|
||||||
|
return "KeyDigit7"
|
||||||
|
case KeyDigit8:
|
||||||
|
return "KeyDigit8"
|
||||||
|
case KeyDigit9:
|
||||||
|
return "KeyDigit9"
|
||||||
case KeyEnd:
|
case KeyEnd:
|
||||||
return "KeyEnd"
|
return "KeyEnd"
|
||||||
case KeyEnter:
|
case KeyEnter:
|
||||||
@ -254,64 +274,52 @@ func (k Key) String() string {
|
|||||||
return "KeyF11"
|
return "KeyF11"
|
||||||
case KeyF12:
|
case KeyF12:
|
||||||
return "KeyF12"
|
return "KeyF12"
|
||||||
case KeyGraveAccent:
|
|
||||||
return "KeyGraveAccent"
|
|
||||||
case KeyHome:
|
case KeyHome:
|
||||||
return "KeyHome"
|
return "KeyHome"
|
||||||
case KeyInsert:
|
case KeyInsert:
|
||||||
return "KeyInsert"
|
return "KeyInsert"
|
||||||
case KeyKP0:
|
case KeyMetaLeft:
|
||||||
return "KeyKP0"
|
return "KeyMetaLeft"
|
||||||
case KeyKP1:
|
case KeyMetaRight:
|
||||||
return "KeyKP1"
|
return "KeyMetaRight"
|
||||||
case KeyKP2:
|
|
||||||
return "KeyKP2"
|
|
||||||
case KeyKP3:
|
|
||||||
return "KeyKP3"
|
|
||||||
case KeyKP4:
|
|
||||||
return "KeyKP4"
|
|
||||||
case KeyKP5:
|
|
||||||
return "KeyKP5"
|
|
||||||
case KeyKP6:
|
|
||||||
return "KeyKP6"
|
|
||||||
case KeyKP7:
|
|
||||||
return "KeyKP7"
|
|
||||||
case KeyKP8:
|
|
||||||
return "KeyKP8"
|
|
||||||
case KeyKP9:
|
|
||||||
return "KeyKP9"
|
|
||||||
case KeyKPAdd:
|
|
||||||
return "KeyKPAdd"
|
|
||||||
case KeyKPDecimal:
|
|
||||||
return "KeyKPDecimal"
|
|
||||||
case KeyKPDivide:
|
|
||||||
return "KeyKPDivide"
|
|
||||||
case KeyKPEnter:
|
|
||||||
return "KeyKPEnter"
|
|
||||||
case KeyKPEqual:
|
|
||||||
return "KeyKPEqual"
|
|
||||||
case KeyKPMultiply:
|
|
||||||
return "KeyKPMultiply"
|
|
||||||
case KeyKPSubtract:
|
|
||||||
return "KeyKPSubtract"
|
|
||||||
case KeyLeft:
|
|
||||||
return "KeyLeft"
|
|
||||||
case KeyLeftAlt:
|
|
||||||
return "KeyLeftAlt"
|
|
||||||
case KeyLeftBracket:
|
|
||||||
return "KeyLeftBracket"
|
|
||||||
case KeyLeftControl:
|
|
||||||
return "KeyLeftControl"
|
|
||||||
case KeyLeftShift:
|
|
||||||
return "KeyLeftShift"
|
|
||||||
case KeyLeftSuper:
|
|
||||||
return "KeyLeftSuper"
|
|
||||||
case KeyMenu:
|
|
||||||
return "KeyMenu"
|
|
||||||
case KeyMinus:
|
case KeyMinus:
|
||||||
return "KeyMinus"
|
return "KeyMinus"
|
||||||
case KeyNumLock:
|
case KeyNumLock:
|
||||||
return "KeyNumLock"
|
return "KeyNumLock"
|
||||||
|
case KeyNumpad0:
|
||||||
|
return "KeyNumpad0"
|
||||||
|
case KeyNumpad1:
|
||||||
|
return "KeyNumpad1"
|
||||||
|
case KeyNumpad2:
|
||||||
|
return "KeyNumpad2"
|
||||||
|
case KeyNumpad3:
|
||||||
|
return "KeyNumpad3"
|
||||||
|
case KeyNumpad4:
|
||||||
|
return "KeyNumpad4"
|
||||||
|
case KeyNumpad5:
|
||||||
|
return "KeyNumpad5"
|
||||||
|
case KeyNumpad6:
|
||||||
|
return "KeyNumpad6"
|
||||||
|
case KeyNumpad7:
|
||||||
|
return "KeyNumpad7"
|
||||||
|
case KeyNumpad8:
|
||||||
|
return "KeyNumpad8"
|
||||||
|
case KeyNumpad9:
|
||||||
|
return "KeyNumpad9"
|
||||||
|
case KeyNumpadAdd:
|
||||||
|
return "KeyNumpadAdd"
|
||||||
|
case KeyNumpadDecimal:
|
||||||
|
return "KeyNumpadDecimal"
|
||||||
|
case KeyNumpadDivide:
|
||||||
|
return "KeyNumpadDivide"
|
||||||
|
case KeyNumpadEnter:
|
||||||
|
return "KeyNumpadEnter"
|
||||||
|
case KeyNumpadEqual:
|
||||||
|
return "KeyNumpadEqual"
|
||||||
|
case KeyNumpadMultiply:
|
||||||
|
return "KeyNumpadMultiply"
|
||||||
|
case KeyNumpadSubtract:
|
||||||
|
return "KeyNumpadSubtract"
|
||||||
case KeyPageDown:
|
case KeyPageDown:
|
||||||
return "KeyPageDown"
|
return "KeyPageDown"
|
||||||
case KeyPageUp:
|
case KeyPageUp:
|
||||||
@ -322,30 +330,22 @@ func (k Key) String() string {
|
|||||||
return "KeyPeriod"
|
return "KeyPeriod"
|
||||||
case KeyPrintScreen:
|
case KeyPrintScreen:
|
||||||
return "KeyPrintScreen"
|
return "KeyPrintScreen"
|
||||||
case KeyRight:
|
case KeyQuote:
|
||||||
return "KeyRight"
|
return "KeyQuote"
|
||||||
case KeyRightAlt:
|
|
||||||
return "KeyRightAlt"
|
|
||||||
case KeyRightBracket:
|
|
||||||
return "KeyRightBracket"
|
|
||||||
case KeyRightControl:
|
|
||||||
return "KeyRightControl"
|
|
||||||
case KeyRightShift:
|
|
||||||
return "KeyRightShift"
|
|
||||||
case KeyRightSuper:
|
|
||||||
return "KeyRightSuper"
|
|
||||||
case KeyScrollLock:
|
case KeyScrollLock:
|
||||||
return "KeyScrollLock"
|
return "KeyScrollLock"
|
||||||
case KeySemicolon:
|
case KeySemicolon:
|
||||||
return "KeySemicolon"
|
return "KeySemicolon"
|
||||||
|
case KeyShiftLeft:
|
||||||
|
return "KeyShiftLeft"
|
||||||
|
case KeyShiftRight:
|
||||||
|
return "KeyShiftRight"
|
||||||
case KeySlash:
|
case KeySlash:
|
||||||
return "KeySlash"
|
return "KeySlash"
|
||||||
case KeySpace:
|
case KeySpace:
|
||||||
return "KeySpace"
|
return "KeySpace"
|
||||||
case KeyTab:
|
case KeyTab:
|
||||||
return "KeyTab"
|
return "KeyTab"
|
||||||
case KeyUp:
|
|
||||||
return "KeyUp"
|
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("driver: invalid key: %d", k))
|
panic(fmt.Sprintf("driver: invalid key: %d", k))
|
||||||
}
|
}
|
||||||
|
@ -26,54 +26,47 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var glfwKeyToDriverKey = map[glfw.Key]driver.Key{
|
var glfwKeyToDriverKey = map[glfw.Key]driver.Key{
|
||||||
glfw.Key0: driver.Key0,
|
|
||||||
glfw.Key1: driver.Key1,
|
|
||||||
glfw.Key2: driver.Key2,
|
|
||||||
glfw.Key3: driver.Key3,
|
|
||||||
glfw.Key4: driver.Key4,
|
|
||||||
glfw.Key5: driver.Key5,
|
|
||||||
glfw.Key6: driver.Key6,
|
|
||||||
glfw.Key7: driver.Key7,
|
|
||||||
glfw.Key8: driver.Key8,
|
|
||||||
glfw.Key9: driver.Key9,
|
|
||||||
glfw.KeyA: driver.KeyA,
|
glfw.KeyA: driver.KeyA,
|
||||||
|
glfw.KeyLeftAlt: driver.KeyAltLeft,
|
||||||
|
glfw.KeyRightAlt: driver.KeyAltRight,
|
||||||
|
glfw.KeyDown: driver.KeyArrowDown,
|
||||||
|
glfw.KeyLeft: driver.KeyArrowLeft,
|
||||||
|
glfw.KeyRight: driver.KeyArrowRight,
|
||||||
|
glfw.KeyUp: driver.KeyArrowUp,
|
||||||
glfw.KeyB: driver.KeyB,
|
glfw.KeyB: driver.KeyB,
|
||||||
glfw.KeyC: driver.KeyC,
|
glfw.KeyGraveAccent: driver.KeyBackquote,
|
||||||
glfw.KeyD: driver.KeyD,
|
|
||||||
glfw.KeyE: driver.KeyE,
|
|
||||||
glfw.KeyF: driver.KeyF,
|
|
||||||
glfw.KeyG: driver.KeyG,
|
|
||||||
glfw.KeyH: driver.KeyH,
|
|
||||||
glfw.KeyI: driver.KeyI,
|
|
||||||
glfw.KeyJ: driver.KeyJ,
|
|
||||||
glfw.KeyK: driver.KeyK,
|
|
||||||
glfw.KeyL: driver.KeyL,
|
|
||||||
glfw.KeyM: driver.KeyM,
|
|
||||||
glfw.KeyN: driver.KeyN,
|
|
||||||
glfw.KeyO: driver.KeyO,
|
|
||||||
glfw.KeyP: driver.KeyP,
|
|
||||||
glfw.KeyQ: driver.KeyQ,
|
|
||||||
glfw.KeyR: driver.KeyR,
|
|
||||||
glfw.KeyS: driver.KeyS,
|
|
||||||
glfw.KeyT: driver.KeyT,
|
|
||||||
glfw.KeyU: driver.KeyU,
|
|
||||||
glfw.KeyV: driver.KeyV,
|
|
||||||
glfw.KeyW: driver.KeyW,
|
|
||||||
glfw.KeyX: driver.KeyX,
|
|
||||||
glfw.KeyY: driver.KeyY,
|
|
||||||
glfw.KeyZ: driver.KeyZ,
|
|
||||||
glfw.KeyApostrophe: driver.KeyApostrophe,
|
|
||||||
glfw.KeyBackslash: driver.KeyBackslash,
|
glfw.KeyBackslash: driver.KeyBackslash,
|
||||||
glfw.KeyBackspace: driver.KeyBackspace,
|
glfw.KeyBackspace: driver.KeyBackspace,
|
||||||
|
glfw.KeyLeftBracket: driver.KeyBracketLeft,
|
||||||
|
glfw.KeyRightBracket: driver.KeyBracketRight,
|
||||||
|
glfw.KeyC: driver.KeyC,
|
||||||
glfw.KeyCapsLock: driver.KeyCapsLock,
|
glfw.KeyCapsLock: driver.KeyCapsLock,
|
||||||
glfw.KeyComma: driver.KeyComma,
|
glfw.KeyComma: driver.KeyComma,
|
||||||
|
glfw.KeyMenu: driver.KeyContextMenu,
|
||||||
|
glfw.KeyLeftControl: driver.KeyControlLeft,
|
||||||
|
glfw.KeyRightControl: driver.KeyControlRight,
|
||||||
|
glfw.KeyD: driver.KeyD,
|
||||||
glfw.KeyDelete: driver.KeyDelete,
|
glfw.KeyDelete: driver.KeyDelete,
|
||||||
glfw.KeyDown: driver.KeyDown,
|
glfw.Key0: driver.KeyDigit0,
|
||||||
|
glfw.Key1: driver.KeyDigit1,
|
||||||
|
glfw.Key2: driver.KeyDigit2,
|
||||||
|
glfw.Key3: driver.KeyDigit3,
|
||||||
|
glfw.Key4: driver.KeyDigit4,
|
||||||
|
glfw.Key5: driver.KeyDigit5,
|
||||||
|
glfw.Key6: driver.KeyDigit6,
|
||||||
|
glfw.Key7: driver.KeyDigit7,
|
||||||
|
glfw.Key8: driver.KeyDigit8,
|
||||||
|
glfw.Key9: driver.KeyDigit9,
|
||||||
|
glfw.KeyE: driver.KeyE,
|
||||||
glfw.KeyEnd: driver.KeyEnd,
|
glfw.KeyEnd: driver.KeyEnd,
|
||||||
glfw.KeyEnter: driver.KeyEnter,
|
glfw.KeyEnter: driver.KeyEnter,
|
||||||
glfw.KeyEqual: driver.KeyEqual,
|
glfw.KeyEqual: driver.KeyEqual,
|
||||||
glfw.KeyEscape: driver.KeyEscape,
|
glfw.KeyEscape: driver.KeyEscape,
|
||||||
|
glfw.KeyF: driver.KeyF,
|
||||||
glfw.KeyF1: driver.KeyF1,
|
glfw.KeyF1: driver.KeyF1,
|
||||||
|
glfw.KeyF10: driver.KeyF10,
|
||||||
|
glfw.KeyF11: driver.KeyF11,
|
||||||
|
glfw.KeyF12: driver.KeyF12,
|
||||||
glfw.KeyF2: driver.KeyF2,
|
glfw.KeyF2: driver.KeyF2,
|
||||||
glfw.KeyF3: driver.KeyF3,
|
glfw.KeyF3: driver.KeyF3,
|
||||||
glfw.KeyF4: driver.KeyF4,
|
glfw.KeyF4: driver.KeyF4,
|
||||||
@ -82,161 +75,168 @@ var glfwKeyToDriverKey = map[glfw.Key]driver.Key{
|
|||||||
glfw.KeyF7: driver.KeyF7,
|
glfw.KeyF7: driver.KeyF7,
|
||||||
glfw.KeyF8: driver.KeyF8,
|
glfw.KeyF8: driver.KeyF8,
|
||||||
glfw.KeyF9: driver.KeyF9,
|
glfw.KeyF9: driver.KeyF9,
|
||||||
glfw.KeyF10: driver.KeyF10,
|
glfw.KeyG: driver.KeyG,
|
||||||
glfw.KeyF11: driver.KeyF11,
|
glfw.KeyH: driver.KeyH,
|
||||||
glfw.KeyF12: driver.KeyF12,
|
|
||||||
glfw.KeyGraveAccent: driver.KeyGraveAccent,
|
|
||||||
glfw.KeyHome: driver.KeyHome,
|
glfw.KeyHome: driver.KeyHome,
|
||||||
|
glfw.KeyI: driver.KeyI,
|
||||||
glfw.KeyInsert: driver.KeyInsert,
|
glfw.KeyInsert: driver.KeyInsert,
|
||||||
glfw.KeyKP0: driver.KeyKP0,
|
glfw.KeyJ: driver.KeyJ,
|
||||||
glfw.KeyKP1: driver.KeyKP1,
|
glfw.KeyK: driver.KeyK,
|
||||||
glfw.KeyKP2: driver.KeyKP2,
|
glfw.KeyL: driver.KeyL,
|
||||||
glfw.KeyKP3: driver.KeyKP3,
|
glfw.KeyM: driver.KeyM,
|
||||||
glfw.KeyKP4: driver.KeyKP4,
|
glfw.KeyLeftSuper: driver.KeyMetaLeft,
|
||||||
glfw.KeyKP5: driver.KeyKP5,
|
glfw.KeyRightSuper: driver.KeyMetaRight,
|
||||||
glfw.KeyKP6: driver.KeyKP6,
|
|
||||||
glfw.KeyKP7: driver.KeyKP7,
|
|
||||||
glfw.KeyKP8: driver.KeyKP8,
|
|
||||||
glfw.KeyKP9: driver.KeyKP9,
|
|
||||||
glfw.KeyKPAdd: driver.KeyKPAdd,
|
|
||||||
glfw.KeyKPDecimal: driver.KeyKPDecimal,
|
|
||||||
glfw.KeyKPDivide: driver.KeyKPDivide,
|
|
||||||
glfw.KeyKPEnter: driver.KeyKPEnter,
|
|
||||||
glfw.KeyKPEqual: driver.KeyKPEqual,
|
|
||||||
glfw.KeyKPMultiply: driver.KeyKPMultiply,
|
|
||||||
glfw.KeyKPSubtract: driver.KeyKPSubtract,
|
|
||||||
glfw.KeyLeft: driver.KeyLeft,
|
|
||||||
glfw.KeyLeftAlt: driver.KeyLeftAlt,
|
|
||||||
glfw.KeyLeftBracket: driver.KeyLeftBracket,
|
|
||||||
glfw.KeyLeftControl: driver.KeyLeftControl,
|
|
||||||
glfw.KeyLeftShift: driver.KeyLeftShift,
|
|
||||||
glfw.KeyLeftSuper: driver.KeyLeftSuper,
|
|
||||||
glfw.KeyMenu: driver.KeyMenu,
|
|
||||||
glfw.KeyMinus: driver.KeyMinus,
|
glfw.KeyMinus: driver.KeyMinus,
|
||||||
|
glfw.KeyN: driver.KeyN,
|
||||||
glfw.KeyNumLock: driver.KeyNumLock,
|
glfw.KeyNumLock: driver.KeyNumLock,
|
||||||
|
glfw.KeyKP0: driver.KeyNumpad0,
|
||||||
|
glfw.KeyKP1: driver.KeyNumpad1,
|
||||||
|
glfw.KeyKP2: driver.KeyNumpad2,
|
||||||
|
glfw.KeyKP3: driver.KeyNumpad3,
|
||||||
|
glfw.KeyKP4: driver.KeyNumpad4,
|
||||||
|
glfw.KeyKP5: driver.KeyNumpad5,
|
||||||
|
glfw.KeyKP6: driver.KeyNumpad6,
|
||||||
|
glfw.KeyKP7: driver.KeyNumpad7,
|
||||||
|
glfw.KeyKP8: driver.KeyNumpad8,
|
||||||
|
glfw.KeyKP9: driver.KeyNumpad9,
|
||||||
|
glfw.KeyKPAdd: driver.KeyNumpadAdd,
|
||||||
|
glfw.KeyKPDecimal: driver.KeyNumpadDecimal,
|
||||||
|
glfw.KeyKPDivide: driver.KeyNumpadDivide,
|
||||||
|
glfw.KeyKPEnter: driver.KeyNumpadEnter,
|
||||||
|
glfw.KeyKPEqual: driver.KeyNumpadEqual,
|
||||||
|
glfw.KeyKPMultiply: driver.KeyNumpadMultiply,
|
||||||
|
glfw.KeyKPSubtract: driver.KeyNumpadSubtract,
|
||||||
|
glfw.KeyO: driver.KeyO,
|
||||||
|
glfw.KeyP: driver.KeyP,
|
||||||
glfw.KeyPageDown: driver.KeyPageDown,
|
glfw.KeyPageDown: driver.KeyPageDown,
|
||||||
glfw.KeyPageUp: driver.KeyPageUp,
|
glfw.KeyPageUp: driver.KeyPageUp,
|
||||||
glfw.KeyPause: driver.KeyPause,
|
glfw.KeyPause: driver.KeyPause,
|
||||||
glfw.KeyPeriod: driver.KeyPeriod,
|
glfw.KeyPeriod: driver.KeyPeriod,
|
||||||
glfw.KeyPrintScreen: driver.KeyPrintScreen,
|
glfw.KeyPrintScreen: driver.KeyPrintScreen,
|
||||||
glfw.KeyRight: driver.KeyRight,
|
glfw.KeyQ: driver.KeyQ,
|
||||||
glfw.KeyRightAlt: driver.KeyRightAlt,
|
glfw.KeyApostrophe: driver.KeyQuote,
|
||||||
glfw.KeyRightBracket: driver.KeyRightBracket,
|
glfw.KeyR: driver.KeyR,
|
||||||
glfw.KeyRightControl: driver.KeyRightControl,
|
glfw.KeyS: driver.KeyS,
|
||||||
glfw.KeyRightShift: driver.KeyRightShift,
|
|
||||||
glfw.KeyRightSuper: driver.KeyRightSuper,
|
|
||||||
glfw.KeyScrollLock: driver.KeyScrollLock,
|
glfw.KeyScrollLock: driver.KeyScrollLock,
|
||||||
glfw.KeySemicolon: driver.KeySemicolon,
|
glfw.KeySemicolon: driver.KeySemicolon,
|
||||||
|
glfw.KeyLeftShift: driver.KeyShiftLeft,
|
||||||
|
glfw.KeyRightShift: driver.KeyShiftRight,
|
||||||
glfw.KeySlash: driver.KeySlash,
|
glfw.KeySlash: driver.KeySlash,
|
||||||
glfw.KeySpace: driver.KeySpace,
|
glfw.KeySpace: driver.KeySpace,
|
||||||
|
glfw.KeyT: driver.KeyT,
|
||||||
glfw.KeyTab: driver.KeyTab,
|
glfw.KeyTab: driver.KeyTab,
|
||||||
glfw.KeyUp: driver.KeyUp,
|
glfw.KeyU: driver.KeyU,
|
||||||
|
glfw.KeyV: driver.KeyV,
|
||||||
|
glfw.KeyW: driver.KeyW,
|
||||||
|
glfw.KeyX: driver.KeyX,
|
||||||
|
glfw.KeyY: driver.KeyY,
|
||||||
|
glfw.KeyZ: driver.KeyZ,
|
||||||
}
|
}
|
||||||
|
|
||||||
var driverKeyToGLFWKey = map[driver.Key]glfw.Key{
|
var driverKeyToGLFWKey = map[driver.Key]glfw.Key{
|
||||||
driver.Key0: glfw.Key0,
|
driver.KeyA: glfw.KeyA,
|
||||||
driver.Key1: glfw.Key1,
|
driver.KeyAltLeft: glfw.KeyLeftAlt,
|
||||||
driver.Key2: glfw.Key2,
|
driver.KeyAltRight: glfw.KeyRightAlt,
|
||||||
driver.Key3: glfw.Key3,
|
driver.KeyArrowDown: glfw.KeyDown,
|
||||||
driver.Key4: glfw.Key4,
|
driver.KeyArrowLeft: glfw.KeyLeft,
|
||||||
driver.Key5: glfw.Key5,
|
driver.KeyArrowRight: glfw.KeyRight,
|
||||||
driver.Key6: glfw.Key6,
|
driver.KeyArrowUp: glfw.KeyUp,
|
||||||
driver.Key7: glfw.Key7,
|
driver.KeyB: glfw.KeyB,
|
||||||
driver.Key8: glfw.Key8,
|
driver.KeyBackquote: glfw.KeyGraveAccent,
|
||||||
driver.Key9: glfw.Key9,
|
driver.KeyBackslash: glfw.KeyBackslash,
|
||||||
driver.KeyA: glfw.KeyA,
|
driver.KeyBackspace: glfw.KeyBackspace,
|
||||||
driver.KeyB: glfw.KeyB,
|
driver.KeyBracketLeft: glfw.KeyLeftBracket,
|
||||||
driver.KeyC: glfw.KeyC,
|
driver.KeyBracketRight: glfw.KeyRightBracket,
|
||||||
driver.KeyD: glfw.KeyD,
|
driver.KeyC: glfw.KeyC,
|
||||||
driver.KeyE: glfw.KeyE,
|
driver.KeyCapsLock: glfw.KeyCapsLock,
|
||||||
driver.KeyF: glfw.KeyF,
|
driver.KeyComma: glfw.KeyComma,
|
||||||
driver.KeyG: glfw.KeyG,
|
driver.KeyContextMenu: glfw.KeyMenu,
|
||||||
driver.KeyH: glfw.KeyH,
|
driver.KeyControlLeft: glfw.KeyLeftControl,
|
||||||
driver.KeyI: glfw.KeyI,
|
driver.KeyControlRight: glfw.KeyRightControl,
|
||||||
driver.KeyJ: glfw.KeyJ,
|
driver.KeyD: glfw.KeyD,
|
||||||
driver.KeyK: glfw.KeyK,
|
driver.KeyDelete: glfw.KeyDelete,
|
||||||
driver.KeyL: glfw.KeyL,
|
driver.KeyDigit0: glfw.Key0,
|
||||||
driver.KeyM: glfw.KeyM,
|
driver.KeyDigit1: glfw.Key1,
|
||||||
driver.KeyN: glfw.KeyN,
|
driver.KeyDigit2: glfw.Key2,
|
||||||
driver.KeyO: glfw.KeyO,
|
driver.KeyDigit3: glfw.Key3,
|
||||||
driver.KeyP: glfw.KeyP,
|
driver.KeyDigit4: glfw.Key4,
|
||||||
driver.KeyQ: glfw.KeyQ,
|
driver.KeyDigit5: glfw.Key5,
|
||||||
driver.KeyR: glfw.KeyR,
|
driver.KeyDigit6: glfw.Key6,
|
||||||
driver.KeyS: glfw.KeyS,
|
driver.KeyDigit7: glfw.Key7,
|
||||||
driver.KeyT: glfw.KeyT,
|
driver.KeyDigit8: glfw.Key8,
|
||||||
driver.KeyU: glfw.KeyU,
|
driver.KeyDigit9: glfw.Key9,
|
||||||
driver.KeyV: glfw.KeyV,
|
driver.KeyE: glfw.KeyE,
|
||||||
driver.KeyW: glfw.KeyW,
|
driver.KeyEnd: glfw.KeyEnd,
|
||||||
driver.KeyX: glfw.KeyX,
|
driver.KeyEnter: glfw.KeyEnter,
|
||||||
driver.KeyY: glfw.KeyY,
|
driver.KeyEqual: glfw.KeyEqual,
|
||||||
driver.KeyZ: glfw.KeyZ,
|
driver.KeyEscape: glfw.KeyEscape,
|
||||||
driver.KeyApostrophe: glfw.KeyApostrophe,
|
driver.KeyF: glfw.KeyF,
|
||||||
driver.KeyBackslash: glfw.KeyBackslash,
|
driver.KeyF1: glfw.KeyF1,
|
||||||
driver.KeyBackspace: glfw.KeyBackspace,
|
driver.KeyF10: glfw.KeyF10,
|
||||||
driver.KeyCapsLock: glfw.KeyCapsLock,
|
driver.KeyF11: glfw.KeyF11,
|
||||||
driver.KeyComma: glfw.KeyComma,
|
driver.KeyF12: glfw.KeyF12,
|
||||||
driver.KeyDelete: glfw.KeyDelete,
|
driver.KeyF2: glfw.KeyF2,
|
||||||
driver.KeyDown: glfw.KeyDown,
|
driver.KeyF3: glfw.KeyF3,
|
||||||
driver.KeyEnd: glfw.KeyEnd,
|
driver.KeyF4: glfw.KeyF4,
|
||||||
driver.KeyEnter: glfw.KeyEnter,
|
driver.KeyF5: glfw.KeyF5,
|
||||||
driver.KeyEqual: glfw.KeyEqual,
|
driver.KeyF6: glfw.KeyF6,
|
||||||
driver.KeyEscape: glfw.KeyEscape,
|
driver.KeyF7: glfw.KeyF7,
|
||||||
driver.KeyF1: glfw.KeyF1,
|
driver.KeyF8: glfw.KeyF8,
|
||||||
driver.KeyF2: glfw.KeyF2,
|
driver.KeyF9: glfw.KeyF9,
|
||||||
driver.KeyF3: glfw.KeyF3,
|
driver.KeyG: glfw.KeyG,
|
||||||
driver.KeyF4: glfw.KeyF4,
|
driver.KeyH: glfw.KeyH,
|
||||||
driver.KeyF5: glfw.KeyF5,
|
driver.KeyHome: glfw.KeyHome,
|
||||||
driver.KeyF6: glfw.KeyF6,
|
driver.KeyI: glfw.KeyI,
|
||||||
driver.KeyF7: glfw.KeyF7,
|
driver.KeyInsert: glfw.KeyInsert,
|
||||||
driver.KeyF8: glfw.KeyF8,
|
driver.KeyJ: glfw.KeyJ,
|
||||||
driver.KeyF9: glfw.KeyF9,
|
driver.KeyK: glfw.KeyK,
|
||||||
driver.KeyF10: glfw.KeyF10,
|
driver.KeyL: glfw.KeyL,
|
||||||
driver.KeyF11: glfw.KeyF11,
|
driver.KeyM: glfw.KeyM,
|
||||||
driver.KeyF12: glfw.KeyF12,
|
driver.KeyMetaLeft: glfw.KeyLeftSuper,
|
||||||
driver.KeyGraveAccent: glfw.KeyGraveAccent,
|
driver.KeyMetaRight: glfw.KeyRightSuper,
|
||||||
driver.KeyHome: glfw.KeyHome,
|
driver.KeyMinus: glfw.KeyMinus,
|
||||||
driver.KeyInsert: glfw.KeyInsert,
|
driver.KeyN: glfw.KeyN,
|
||||||
driver.KeyKP0: glfw.KeyKP0,
|
driver.KeyNumLock: glfw.KeyNumLock,
|
||||||
driver.KeyKP1: glfw.KeyKP1,
|
driver.KeyNumpad0: glfw.KeyKP0,
|
||||||
driver.KeyKP2: glfw.KeyKP2,
|
driver.KeyNumpad1: glfw.KeyKP1,
|
||||||
driver.KeyKP3: glfw.KeyKP3,
|
driver.KeyNumpad2: glfw.KeyKP2,
|
||||||
driver.KeyKP4: glfw.KeyKP4,
|
driver.KeyNumpad3: glfw.KeyKP3,
|
||||||
driver.KeyKP5: glfw.KeyKP5,
|
driver.KeyNumpad4: glfw.KeyKP4,
|
||||||
driver.KeyKP6: glfw.KeyKP6,
|
driver.KeyNumpad5: glfw.KeyKP5,
|
||||||
driver.KeyKP7: glfw.KeyKP7,
|
driver.KeyNumpad6: glfw.KeyKP6,
|
||||||
driver.KeyKP8: glfw.KeyKP8,
|
driver.KeyNumpad7: glfw.KeyKP7,
|
||||||
driver.KeyKP9: glfw.KeyKP9,
|
driver.KeyNumpad8: glfw.KeyKP8,
|
||||||
driver.KeyKPAdd: glfw.KeyKPAdd,
|
driver.KeyNumpad9: glfw.KeyKP9,
|
||||||
driver.KeyKPDecimal: glfw.KeyKPDecimal,
|
driver.KeyNumpadAdd: glfw.KeyKPAdd,
|
||||||
driver.KeyKPDivide: glfw.KeyKPDivide,
|
driver.KeyNumpadDecimal: glfw.KeyKPDecimal,
|
||||||
driver.KeyKPEnter: glfw.KeyKPEnter,
|
driver.KeyNumpadDivide: glfw.KeyKPDivide,
|
||||||
driver.KeyKPEqual: glfw.KeyKPEqual,
|
driver.KeyNumpadEnter: glfw.KeyKPEnter,
|
||||||
driver.KeyKPMultiply: glfw.KeyKPMultiply,
|
driver.KeyNumpadEqual: glfw.KeyKPEqual,
|
||||||
driver.KeyKPSubtract: glfw.KeyKPSubtract,
|
driver.KeyNumpadMultiply: glfw.KeyKPMultiply,
|
||||||
driver.KeyLeft: glfw.KeyLeft,
|
driver.KeyNumpadSubtract: glfw.KeyKPSubtract,
|
||||||
driver.KeyLeftAlt: glfw.KeyLeftAlt,
|
driver.KeyO: glfw.KeyO,
|
||||||
driver.KeyLeftBracket: glfw.KeyLeftBracket,
|
driver.KeyP: glfw.KeyP,
|
||||||
driver.KeyLeftControl: glfw.KeyLeftControl,
|
driver.KeyPageDown: glfw.KeyPageDown,
|
||||||
driver.KeyLeftShift: glfw.KeyLeftShift,
|
driver.KeyPageUp: glfw.KeyPageUp,
|
||||||
driver.KeyLeftSuper: glfw.KeyLeftSuper,
|
driver.KeyPause: glfw.KeyPause,
|
||||||
driver.KeyMenu: glfw.KeyMenu,
|
driver.KeyPeriod: glfw.KeyPeriod,
|
||||||
driver.KeyMinus: glfw.KeyMinus,
|
driver.KeyPrintScreen: glfw.KeyPrintScreen,
|
||||||
driver.KeyNumLock: glfw.KeyNumLock,
|
driver.KeyQ: glfw.KeyQ,
|
||||||
driver.KeyPageDown: glfw.KeyPageDown,
|
driver.KeyQuote: glfw.KeyApostrophe,
|
||||||
driver.KeyPageUp: glfw.KeyPageUp,
|
driver.KeyR: glfw.KeyR,
|
||||||
driver.KeyPause: glfw.KeyPause,
|
driver.KeyS: glfw.KeyS,
|
||||||
driver.KeyPeriod: glfw.KeyPeriod,
|
driver.KeyScrollLock: glfw.KeyScrollLock,
|
||||||
driver.KeyPrintScreen: glfw.KeyPrintScreen,
|
driver.KeySemicolon: glfw.KeySemicolon,
|
||||||
driver.KeyRight: glfw.KeyRight,
|
driver.KeyShiftLeft: glfw.KeyLeftShift,
|
||||||
driver.KeyRightAlt: glfw.KeyRightAlt,
|
driver.KeyShiftRight: glfw.KeyRightShift,
|
||||||
driver.KeyRightBracket: glfw.KeyRightBracket,
|
driver.KeySlash: glfw.KeySlash,
|
||||||
driver.KeyRightControl: glfw.KeyRightControl,
|
driver.KeySpace: glfw.KeySpace,
|
||||||
driver.KeyRightShift: glfw.KeyRightShift,
|
driver.KeyT: glfw.KeyT,
|
||||||
driver.KeyRightSuper: glfw.KeyRightSuper,
|
driver.KeyTab: glfw.KeyTab,
|
||||||
driver.KeyScrollLock: glfw.KeyScrollLock,
|
driver.KeyU: glfw.KeyU,
|
||||||
driver.KeySemicolon: glfw.KeySemicolon,
|
driver.KeyV: glfw.KeyV,
|
||||||
driver.KeySlash: glfw.KeySlash,
|
driver.KeyW: glfw.KeyW,
|
||||||
driver.KeySpace: glfw.KeySpace,
|
driver.KeyX: glfw.KeyX,
|
||||||
driver.KeyTab: glfw.KeyTab,
|
driver.KeyY: glfw.KeyY,
|
||||||
driver.KeyUp: glfw.KeyUp,
|
driver.KeyZ: glfw.KeyZ,
|
||||||
}
|
}
|
||||||
|
@ -349,10 +349,10 @@ func (i *Input) updateFromEvent(e js.Value) {
|
|||||||
c := e.Get("code")
|
c := e.Get("code")
|
||||||
if c.Type() != js.TypeString {
|
if c.Type() != js.TypeString {
|
||||||
code := e.Get("keyCode").Int()
|
code := e.Get("keyCode").Int()
|
||||||
if edgeKeyCodeToDriverKey[code] == driver.KeyUp ||
|
if edgeKeyCodeToDriverKey[code] == driver.KeyArrowUp ||
|
||||||
edgeKeyCodeToDriverKey[code] == driver.KeyDown ||
|
edgeKeyCodeToDriverKey[code] == driver.KeyArrowDown ||
|
||||||
edgeKeyCodeToDriverKey[code] == driver.KeyLeft ||
|
edgeKeyCodeToDriverKey[code] == driver.KeyArrowLeft ||
|
||||||
edgeKeyCodeToDriverKey[code] == driver.KeyRight ||
|
edgeKeyCodeToDriverKey[code] == driver.KeyArrowRight ||
|
||||||
edgeKeyCodeToDriverKey[code] == driver.KeyBackspace ||
|
edgeKeyCodeToDriverKey[code] == driver.KeyBackspace ||
|
||||||
edgeKeyCodeToDriverKey[code] == driver.KeyTab {
|
edgeKeyCodeToDriverKey[code] == driver.KeyTab {
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
@ -360,10 +360,10 @@ func (i *Input) updateFromEvent(e js.Value) {
|
|||||||
i.keyDownEdge(code)
|
i.keyDownEdge(code)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if jsutil.Equal(c, driverKeyToJSKey[driver.KeyUp]) ||
|
if jsutil.Equal(c, driverKeyToJSKey[driver.KeyArrowUp]) ||
|
||||||
jsutil.Equal(c, driverKeyToJSKey[driver.KeyDown]) ||
|
jsutil.Equal(c, driverKeyToJSKey[driver.KeyArrowDown]) ||
|
||||||
jsutil.Equal(c, driverKeyToJSKey[driver.KeyLeft]) ||
|
jsutil.Equal(c, driverKeyToJSKey[driver.KeyArrowLeft]) ||
|
||||||
jsutil.Equal(c, driverKeyToJSKey[driver.KeyRight]) ||
|
jsutil.Equal(c, driverKeyToJSKey[driver.KeyArrowRight]) ||
|
||||||
jsutil.Equal(c, driverKeyToJSKey[driver.KeyBackspace]) ||
|
jsutil.Equal(c, driverKeyToJSKey[driver.KeyBackspace]) ||
|
||||||
jsutil.Equal(c, driverKeyToJSKey[driver.KeyTab]) {
|
jsutil.Equal(c, driverKeyToJSKey[driver.KeyTab]) {
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
|
@ -23,120 +23,120 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var driverKeyToJSKey = map[driver.Key]js.Value{
|
var driverKeyToJSKey = map[driver.Key]js.Value{
|
||||||
driver.Key0: js.ValueOf("Digit0"),
|
driver.KeyA: js.ValueOf("KeyA"),
|
||||||
driver.Key1: js.ValueOf("Digit1"),
|
driver.KeyAltLeft: js.ValueOf("AltLeft"),
|
||||||
driver.Key2: js.ValueOf("Digit2"),
|
driver.KeyAltRight: js.ValueOf("AltRight"),
|
||||||
driver.Key3: js.ValueOf("Digit3"),
|
driver.KeyArrowDown: js.ValueOf("ArrowDown"),
|
||||||
driver.Key4: js.ValueOf("Digit4"),
|
driver.KeyArrowLeft: js.ValueOf("ArrowLeft"),
|
||||||
driver.Key5: js.ValueOf("Digit5"),
|
driver.KeyArrowRight: js.ValueOf("ArrowRight"),
|
||||||
driver.Key6: js.ValueOf("Digit6"),
|
driver.KeyArrowUp: js.ValueOf("ArrowUp"),
|
||||||
driver.Key7: js.ValueOf("Digit7"),
|
driver.KeyB: js.ValueOf("KeyB"),
|
||||||
driver.Key8: js.ValueOf("Digit8"),
|
driver.KeyBackquote: js.ValueOf("Backquote"),
|
||||||
driver.Key9: js.ValueOf("Digit9"),
|
driver.KeyBackslash: js.ValueOf("Backslash"),
|
||||||
driver.KeyA: js.ValueOf("KeyA"),
|
driver.KeyBackspace: js.ValueOf("Backspace"),
|
||||||
driver.KeyApostrophe: js.ValueOf("Quote"),
|
driver.KeyBracketLeft: js.ValueOf("BracketLeft"),
|
||||||
driver.KeyB: js.ValueOf("KeyB"),
|
driver.KeyBracketRight: js.ValueOf("BracketRight"),
|
||||||
driver.KeyBackslash: js.ValueOf("Backslash"),
|
driver.KeyC: js.ValueOf("KeyC"),
|
||||||
driver.KeyBackspace: js.ValueOf("Backspace"),
|
driver.KeyCapsLock: js.ValueOf("CapsLock"),
|
||||||
driver.KeyC: js.ValueOf("KeyC"),
|
driver.KeyComma: js.ValueOf("Comma"),
|
||||||
driver.KeyCapsLock: js.ValueOf("CapsLock"),
|
driver.KeyContextMenu: js.ValueOf("ContextMenu"),
|
||||||
driver.KeyComma: js.ValueOf("Comma"),
|
driver.KeyControlLeft: js.ValueOf("ControlLeft"),
|
||||||
driver.KeyD: js.ValueOf("KeyD"),
|
driver.KeyControlRight: js.ValueOf("ControlRight"),
|
||||||
driver.KeyDelete: js.ValueOf("Delete"),
|
driver.KeyD: js.ValueOf("KeyD"),
|
||||||
driver.KeyDown: js.ValueOf("ArrowDown"),
|
driver.KeyDelete: js.ValueOf("Delete"),
|
||||||
driver.KeyE: js.ValueOf("KeyE"),
|
driver.KeyDigit0: js.ValueOf("Digit0"),
|
||||||
driver.KeyEnd: js.ValueOf("End"),
|
driver.KeyDigit1: js.ValueOf("Digit1"),
|
||||||
driver.KeyEnter: js.ValueOf("Enter"),
|
driver.KeyDigit2: js.ValueOf("Digit2"),
|
||||||
driver.KeyEqual: js.ValueOf("Equal"),
|
driver.KeyDigit3: js.ValueOf("Digit3"),
|
||||||
driver.KeyEscape: js.ValueOf("Escape"),
|
driver.KeyDigit4: js.ValueOf("Digit4"),
|
||||||
driver.KeyF: js.ValueOf("KeyF"),
|
driver.KeyDigit5: js.ValueOf("Digit5"),
|
||||||
driver.KeyF1: js.ValueOf("F1"),
|
driver.KeyDigit6: js.ValueOf("Digit6"),
|
||||||
driver.KeyF10: js.ValueOf("F10"),
|
driver.KeyDigit7: js.ValueOf("Digit7"),
|
||||||
driver.KeyF11: js.ValueOf("F11"),
|
driver.KeyDigit8: js.ValueOf("Digit8"),
|
||||||
driver.KeyF12: js.ValueOf("F12"),
|
driver.KeyDigit9: js.ValueOf("Digit9"),
|
||||||
driver.KeyF2: js.ValueOf("F2"),
|
driver.KeyE: js.ValueOf("KeyE"),
|
||||||
driver.KeyF3: js.ValueOf("F3"),
|
driver.KeyEnd: js.ValueOf("End"),
|
||||||
driver.KeyF4: js.ValueOf("F4"),
|
driver.KeyEnter: js.ValueOf("Enter"),
|
||||||
driver.KeyF5: js.ValueOf("F5"),
|
driver.KeyEqual: js.ValueOf("Equal"),
|
||||||
driver.KeyF6: js.ValueOf("F6"),
|
driver.KeyEscape: js.ValueOf("Escape"),
|
||||||
driver.KeyF7: js.ValueOf("F7"),
|
driver.KeyF: js.ValueOf("KeyF"),
|
||||||
driver.KeyF8: js.ValueOf("F8"),
|
driver.KeyF1: js.ValueOf("F1"),
|
||||||
driver.KeyF9: js.ValueOf("F9"),
|
driver.KeyF10: js.ValueOf("F10"),
|
||||||
driver.KeyG: js.ValueOf("KeyG"),
|
driver.KeyF11: js.ValueOf("F11"),
|
||||||
driver.KeyGraveAccent: js.ValueOf("Backquote"),
|
driver.KeyF12: js.ValueOf("F12"),
|
||||||
driver.KeyH: js.ValueOf("KeyH"),
|
driver.KeyF2: js.ValueOf("F2"),
|
||||||
driver.KeyHome: js.ValueOf("Home"),
|
driver.KeyF3: js.ValueOf("F3"),
|
||||||
driver.KeyI: js.ValueOf("KeyI"),
|
driver.KeyF4: js.ValueOf("F4"),
|
||||||
driver.KeyInsert: js.ValueOf("Insert"),
|
driver.KeyF5: js.ValueOf("F5"),
|
||||||
driver.KeyJ: js.ValueOf("KeyJ"),
|
driver.KeyF6: js.ValueOf("F6"),
|
||||||
driver.KeyK: js.ValueOf("KeyK"),
|
driver.KeyF7: js.ValueOf("F7"),
|
||||||
driver.KeyKP0: js.ValueOf("Numpad0"),
|
driver.KeyF8: js.ValueOf("F8"),
|
||||||
driver.KeyKP1: js.ValueOf("Numpad1"),
|
driver.KeyF9: js.ValueOf("F9"),
|
||||||
driver.KeyKP2: js.ValueOf("Numpad2"),
|
driver.KeyG: js.ValueOf("KeyG"),
|
||||||
driver.KeyKP3: js.ValueOf("Numpad3"),
|
driver.KeyH: js.ValueOf("KeyH"),
|
||||||
driver.KeyKP4: js.ValueOf("Numpad4"),
|
driver.KeyHome: js.ValueOf("Home"),
|
||||||
driver.KeyKP5: js.ValueOf("Numpad5"),
|
driver.KeyI: js.ValueOf("KeyI"),
|
||||||
driver.KeyKP6: js.ValueOf("Numpad6"),
|
driver.KeyInsert: js.ValueOf("Insert"),
|
||||||
driver.KeyKP7: js.ValueOf("Numpad7"),
|
driver.KeyJ: js.ValueOf("KeyJ"),
|
||||||
driver.KeyKP8: js.ValueOf("Numpad8"),
|
driver.KeyK: js.ValueOf("KeyK"),
|
||||||
driver.KeyKP9: js.ValueOf("Numpad9"),
|
driver.KeyL: js.ValueOf("KeyL"),
|
||||||
driver.KeyKPAdd: js.ValueOf("NumpadAdd"),
|
driver.KeyM: js.ValueOf("KeyM"),
|
||||||
driver.KeyKPDecimal: js.ValueOf("NumpadDecimal"),
|
driver.KeyMetaLeft: js.ValueOf("MetaLeft"),
|
||||||
driver.KeyKPDivide: js.ValueOf("NumpadDivide"),
|
driver.KeyMetaRight: js.ValueOf("MetaRight"),
|
||||||
driver.KeyKPEnter: js.ValueOf("NumpadEnter"),
|
driver.KeyMinus: js.ValueOf("Minus"),
|
||||||
driver.KeyKPEqual: js.ValueOf("NumpadEqual"),
|
driver.KeyN: js.ValueOf("KeyN"),
|
||||||
driver.KeyKPMultiply: js.ValueOf("NumpadMultiply"),
|
driver.KeyNumLock: js.ValueOf("NumLock"),
|
||||||
driver.KeyKPSubtract: js.ValueOf("NumpadSubtract"),
|
driver.KeyNumpad0: js.ValueOf("Numpad0"),
|
||||||
driver.KeyL: js.ValueOf("KeyL"),
|
driver.KeyNumpad1: js.ValueOf("Numpad1"),
|
||||||
driver.KeyLeft: js.ValueOf("ArrowLeft"),
|
driver.KeyNumpad2: js.ValueOf("Numpad2"),
|
||||||
driver.KeyLeftAlt: js.ValueOf("AltLeft"),
|
driver.KeyNumpad3: js.ValueOf("Numpad3"),
|
||||||
driver.KeyLeftBracket: js.ValueOf("BracketLeft"),
|
driver.KeyNumpad4: js.ValueOf("Numpad4"),
|
||||||
driver.KeyLeftControl: js.ValueOf("ControlLeft"),
|
driver.KeyNumpad5: js.ValueOf("Numpad5"),
|
||||||
driver.KeyLeftShift: js.ValueOf("ShiftLeft"),
|
driver.KeyNumpad6: js.ValueOf("Numpad6"),
|
||||||
driver.KeyLeftSuper: js.ValueOf("MetaLeft"),
|
driver.KeyNumpad7: js.ValueOf("Numpad7"),
|
||||||
driver.KeyM: js.ValueOf("KeyM"),
|
driver.KeyNumpad8: js.ValueOf("Numpad8"),
|
||||||
driver.KeyMenu: js.ValueOf("ContextMenu"),
|
driver.KeyNumpad9: js.ValueOf("Numpad9"),
|
||||||
driver.KeyMinus: js.ValueOf("Minus"),
|
driver.KeyNumpadAdd: js.ValueOf("NumpadAdd"),
|
||||||
driver.KeyN: js.ValueOf("KeyN"),
|
driver.KeyNumpadDecimal: js.ValueOf("NumpadDecimal"),
|
||||||
driver.KeyNumLock: js.ValueOf("NumLock"),
|
driver.KeyNumpadDivide: js.ValueOf("NumpadDivide"),
|
||||||
driver.KeyO: js.ValueOf("KeyO"),
|
driver.KeyNumpadEnter: js.ValueOf("NumpadEnter"),
|
||||||
driver.KeyP: js.ValueOf("KeyP"),
|
driver.KeyNumpadEqual: js.ValueOf("NumpadEqual"),
|
||||||
driver.KeyPageDown: js.ValueOf("PageDown"),
|
driver.KeyNumpadMultiply: js.ValueOf("NumpadMultiply"),
|
||||||
driver.KeyPageUp: js.ValueOf("PageUp"),
|
driver.KeyNumpadSubtract: js.ValueOf("NumpadSubtract"),
|
||||||
driver.KeyPause: js.ValueOf("Pause"),
|
driver.KeyO: js.ValueOf("KeyO"),
|
||||||
driver.KeyPeriod: js.ValueOf("Period"),
|
driver.KeyP: js.ValueOf("KeyP"),
|
||||||
driver.KeyPrintScreen: js.ValueOf("PrintScreen"),
|
driver.KeyPageDown: js.ValueOf("PageDown"),
|
||||||
driver.KeyQ: js.ValueOf("KeyQ"),
|
driver.KeyPageUp: js.ValueOf("PageUp"),
|
||||||
driver.KeyR: js.ValueOf("KeyR"),
|
driver.KeyPause: js.ValueOf("Pause"),
|
||||||
driver.KeyRight: js.ValueOf("ArrowRight"),
|
driver.KeyPeriod: js.ValueOf("Period"),
|
||||||
driver.KeyRightAlt: js.ValueOf("AltRight"),
|
driver.KeyPrintScreen: js.ValueOf("PrintScreen"),
|
||||||
driver.KeyRightBracket: js.ValueOf("BracketRight"),
|
driver.KeyQ: js.ValueOf("KeyQ"),
|
||||||
driver.KeyRightControl: js.ValueOf("ControlRight"),
|
driver.KeyQuote: js.ValueOf("Quote"),
|
||||||
driver.KeyRightShift: js.ValueOf("ShiftRight"),
|
driver.KeyR: js.ValueOf("KeyR"),
|
||||||
driver.KeyRightSuper: js.ValueOf("MetaRight"),
|
driver.KeyS: js.ValueOf("KeyS"),
|
||||||
driver.KeyS: js.ValueOf("KeyS"),
|
driver.KeyScrollLock: js.ValueOf("ScrollLock"),
|
||||||
driver.KeyScrollLock: js.ValueOf("ScrollLock"),
|
driver.KeySemicolon: js.ValueOf("Semicolon"),
|
||||||
driver.KeySemicolon: js.ValueOf("Semicolon"),
|
driver.KeyShiftLeft: js.ValueOf("ShiftLeft"),
|
||||||
driver.KeySlash: js.ValueOf("Slash"),
|
driver.KeyShiftRight: js.ValueOf("ShiftRight"),
|
||||||
driver.KeySpace: js.ValueOf("Space"),
|
driver.KeySlash: js.ValueOf("Slash"),
|
||||||
driver.KeyT: js.ValueOf("KeyT"),
|
driver.KeySpace: js.ValueOf("Space"),
|
||||||
driver.KeyTab: js.ValueOf("Tab"),
|
driver.KeyT: js.ValueOf("KeyT"),
|
||||||
driver.KeyU: js.ValueOf("KeyU"),
|
driver.KeyTab: js.ValueOf("Tab"),
|
||||||
driver.KeyUp: js.ValueOf("ArrowUp"),
|
driver.KeyU: js.ValueOf("KeyU"),
|
||||||
driver.KeyV: js.ValueOf("KeyV"),
|
driver.KeyV: js.ValueOf("KeyV"),
|
||||||
driver.KeyW: js.ValueOf("KeyW"),
|
driver.KeyW: js.ValueOf("KeyW"),
|
||||||
driver.KeyX: js.ValueOf("KeyX"),
|
driver.KeyX: js.ValueOf("KeyX"),
|
||||||
driver.KeyY: js.ValueOf("KeyY"),
|
driver.KeyY: js.ValueOf("KeyY"),
|
||||||
driver.KeyZ: js.ValueOf("KeyZ"),
|
driver.KeyZ: js.ValueOf("KeyZ"),
|
||||||
}
|
}
|
||||||
|
|
||||||
var edgeKeyCodeToDriverKey = map[int]driver.Key{
|
var edgeKeyCodeToDriverKey = map[int]driver.Key{
|
||||||
8: driver.KeyBackspace,
|
8: driver.KeyBackspace,
|
||||||
9: driver.KeyTab,
|
9: driver.KeyTab,
|
||||||
13: driver.KeyEnter,
|
13: driver.KeyEnter,
|
||||||
16: driver.KeyLeftShift,
|
16: driver.KeyShiftLeft,
|
||||||
17: driver.KeyLeftControl,
|
17: driver.KeyControlLeft,
|
||||||
18: driver.KeyLeftAlt,
|
18: driver.KeyAltLeft,
|
||||||
19: driver.KeyPause,
|
19: driver.KeyPause,
|
||||||
20: driver.KeyCapsLock,
|
20: driver.KeyCapsLock,
|
||||||
27: driver.KeyEscape,
|
27: driver.KeyEscape,
|
||||||
@ -145,22 +145,22 @@ var edgeKeyCodeToDriverKey = map[int]driver.Key{
|
|||||||
34: driver.KeyPageDown,
|
34: driver.KeyPageDown,
|
||||||
35: driver.KeyEnd,
|
35: driver.KeyEnd,
|
||||||
36: driver.KeyHome,
|
36: driver.KeyHome,
|
||||||
37: driver.KeyLeft,
|
37: driver.KeyArrowLeft,
|
||||||
38: driver.KeyUp,
|
38: driver.KeyArrowUp,
|
||||||
39: driver.KeyRight,
|
39: driver.KeyArrowRight,
|
||||||
40: driver.KeyDown,
|
40: driver.KeyArrowDown,
|
||||||
45: driver.KeyInsert,
|
45: driver.KeyInsert,
|
||||||
46: driver.KeyDelete,
|
46: driver.KeyDelete,
|
||||||
48: driver.Key0,
|
48: driver.KeyDigit0,
|
||||||
49: driver.Key1,
|
49: driver.KeyDigit1,
|
||||||
50: driver.Key2,
|
50: driver.KeyDigit2,
|
||||||
51: driver.Key3,
|
51: driver.KeyDigit3,
|
||||||
52: driver.Key4,
|
52: driver.KeyDigit4,
|
||||||
53: driver.Key5,
|
53: driver.KeyDigit5,
|
||||||
54: driver.Key6,
|
54: driver.KeyDigit6,
|
||||||
55: driver.Key7,
|
55: driver.KeyDigit7,
|
||||||
56: driver.Key8,
|
56: driver.KeyDigit8,
|
||||||
57: driver.Key9,
|
57: driver.KeyDigit9,
|
||||||
65: driver.KeyA,
|
65: driver.KeyA,
|
||||||
66: driver.KeyB,
|
66: driver.KeyB,
|
||||||
67: driver.KeyC,
|
67: driver.KeyC,
|
||||||
@ -187,24 +187,24 @@ var edgeKeyCodeToDriverKey = map[int]driver.Key{
|
|||||||
88: driver.KeyX,
|
88: driver.KeyX,
|
||||||
89: driver.KeyY,
|
89: driver.KeyY,
|
||||||
90: driver.KeyZ,
|
90: driver.KeyZ,
|
||||||
91: driver.KeyLeftSuper,
|
91: driver.KeyMetaLeft,
|
||||||
92: driver.KeyRightSuper,
|
92: driver.KeyMetaRight,
|
||||||
93: driver.KeyMenu,
|
93: driver.KeyContextMenu,
|
||||||
96: driver.KeyKP0,
|
96: driver.KeyNumpad0,
|
||||||
97: driver.KeyKP1,
|
97: driver.KeyNumpad1,
|
||||||
98: driver.KeyKP2,
|
98: driver.KeyNumpad2,
|
||||||
99: driver.KeyKP3,
|
99: driver.KeyNumpad3,
|
||||||
100: driver.KeyKP4,
|
100: driver.KeyNumpad4,
|
||||||
101: driver.KeyKP5,
|
101: driver.KeyNumpad5,
|
||||||
102: driver.KeyKP6,
|
102: driver.KeyNumpad6,
|
||||||
103: driver.KeyKP7,
|
103: driver.KeyNumpad7,
|
||||||
104: driver.KeyKP8,
|
104: driver.KeyNumpad8,
|
||||||
105: driver.KeyKP9,
|
105: driver.KeyNumpad9,
|
||||||
106: driver.KeyKPMultiply,
|
106: driver.KeyNumpadMultiply,
|
||||||
107: driver.KeyKPAdd,
|
107: driver.KeyNumpadAdd,
|
||||||
109: driver.KeyKPSubtract,
|
109: driver.KeyNumpadSubtract,
|
||||||
110: driver.KeyKPDecimal,
|
110: driver.KeyNumpadDecimal,
|
||||||
111: driver.KeyKPDivide,
|
111: driver.KeyNumpadDivide,
|
||||||
112: driver.KeyF1,
|
112: driver.KeyF1,
|
||||||
113: driver.KeyF2,
|
113: driver.KeyF2,
|
||||||
114: driver.KeyF3,
|
114: driver.KeyF3,
|
||||||
@ -225,9 +225,9 @@ var edgeKeyCodeToDriverKey = map[int]driver.Key{
|
|||||||
189: driver.KeyMinus,
|
189: driver.KeyMinus,
|
||||||
190: driver.KeyPeriod,
|
190: driver.KeyPeriod,
|
||||||
191: driver.KeySlash,
|
191: driver.KeySlash,
|
||||||
192: driver.KeyGraveAccent,
|
192: driver.KeyBackquote,
|
||||||
219: driver.KeyLeftBracket,
|
219: driver.KeyBracketLeft,
|
||||||
220: driver.KeyBackslash,
|
220: driver.KeyBackslash,
|
||||||
221: driver.KeyRightBracket,
|
221: driver.KeyBracketRight,
|
||||||
222: driver.KeyApostrophe,
|
222: driver.KeyQuote,
|
||||||
}
|
}
|
||||||
|
@ -49,16 +49,16 @@ var gbuildKeyToDriverKey = map[key.Code]driver.Key{
|
|||||||
key.CodeX: driver.KeyX,
|
key.CodeX: driver.KeyX,
|
||||||
key.CodeY: driver.KeyY,
|
key.CodeY: driver.KeyY,
|
||||||
key.CodeZ: driver.KeyZ,
|
key.CodeZ: driver.KeyZ,
|
||||||
key.Code1: driver.Key1,
|
key.Code1: driver.KeyDigit1,
|
||||||
key.Code2: driver.Key2,
|
key.Code2: driver.KeyDigit2,
|
||||||
key.Code3: driver.Key3,
|
key.Code3: driver.KeyDigit3,
|
||||||
key.Code4: driver.Key4,
|
key.Code4: driver.KeyDigit4,
|
||||||
key.Code5: driver.Key5,
|
key.Code5: driver.KeyDigit5,
|
||||||
key.Code6: driver.Key6,
|
key.Code6: driver.KeyDigit6,
|
||||||
key.Code7: driver.Key7,
|
key.Code7: driver.KeyDigit7,
|
||||||
key.Code8: driver.Key8,
|
key.Code8: driver.KeyDigit8,
|
||||||
key.Code9: driver.Key9,
|
key.Code9: driver.KeyDigit9,
|
||||||
key.Code0: driver.Key0,
|
key.Code0: driver.KeyDigit0,
|
||||||
key.CodeReturnEnter: driver.KeyEnter,
|
key.CodeReturnEnter: driver.KeyEnter,
|
||||||
key.CodeEscape: driver.KeyEscape,
|
key.CodeEscape: driver.KeyEscape,
|
||||||
key.CodeDeleteBackspace: driver.KeyBackspace,
|
key.CodeDeleteBackspace: driver.KeyBackspace,
|
||||||
@ -66,12 +66,12 @@ var gbuildKeyToDriverKey = map[key.Code]driver.Key{
|
|||||||
key.CodeSpacebar: driver.KeySpace,
|
key.CodeSpacebar: driver.KeySpace,
|
||||||
key.CodeHyphenMinus: driver.KeyMinus,
|
key.CodeHyphenMinus: driver.KeyMinus,
|
||||||
key.CodeEqualSign: driver.KeyEqual,
|
key.CodeEqualSign: driver.KeyEqual,
|
||||||
key.CodeLeftSquareBracket: driver.KeyLeftBracket,
|
key.CodeLeftSquareBracket: driver.KeyBracketLeft,
|
||||||
key.CodeRightSquareBracket: driver.KeyRightBracket,
|
key.CodeRightSquareBracket: driver.KeyBracketRight,
|
||||||
key.CodeBackslash: driver.KeyBackslash,
|
key.CodeBackslash: driver.KeyBackslash,
|
||||||
key.CodeSemicolon: driver.KeySemicolon,
|
key.CodeSemicolon: driver.KeySemicolon,
|
||||||
key.CodeApostrophe: driver.KeyApostrophe,
|
key.CodeApostrophe: driver.KeyQuote,
|
||||||
key.CodeGraveAccent: driver.KeyGraveAccent,
|
key.CodeGraveAccent: driver.KeyBackquote,
|
||||||
key.CodeComma: driver.KeyComma,
|
key.CodeComma: driver.KeyComma,
|
||||||
key.CodeFullStop: driver.KeyPeriod,
|
key.CodeFullStop: driver.KeyPeriod,
|
||||||
key.CodeSlash: driver.KeySlash,
|
key.CodeSlash: driver.KeySlash,
|
||||||
@ -95,34 +95,34 @@ var gbuildKeyToDriverKey = map[key.Code]driver.Key{
|
|||||||
key.CodeDeleteForward: driver.KeyDelete,
|
key.CodeDeleteForward: driver.KeyDelete,
|
||||||
key.CodeEnd: driver.KeyEnd,
|
key.CodeEnd: driver.KeyEnd,
|
||||||
key.CodePageDown: driver.KeyPageDown,
|
key.CodePageDown: driver.KeyPageDown,
|
||||||
key.CodeRightArrow: driver.KeyRight,
|
key.CodeRightArrow: driver.KeyArrowRight,
|
||||||
key.CodeLeftArrow: driver.KeyLeft,
|
key.CodeLeftArrow: driver.KeyArrowLeft,
|
||||||
key.CodeDownArrow: driver.KeyDown,
|
key.CodeDownArrow: driver.KeyArrowDown,
|
||||||
key.CodeUpArrow: driver.KeyUp,
|
key.CodeUpArrow: driver.KeyArrowUp,
|
||||||
key.CodeKeypadNumLock: driver.KeyNumLock,
|
key.CodeKeypadNumLock: driver.KeyNumLock,
|
||||||
key.CodeKeypadSlash: driver.KeyKPDivide,
|
key.CodeKeypadSlash: driver.KeyNumpadDivide,
|
||||||
key.CodeKeypadAsterisk: driver.KeyKPMultiply,
|
key.CodeKeypadAsterisk: driver.KeyNumpadMultiply,
|
||||||
key.CodeKeypadHyphenMinus: driver.KeyKPSubtract,
|
key.CodeKeypadHyphenMinus: driver.KeyNumpadSubtract,
|
||||||
key.CodeKeypadPlusSign: driver.KeyKPAdd,
|
key.CodeKeypadPlusSign: driver.KeyNumpadAdd,
|
||||||
key.CodeKeypadEnter: driver.KeyKPEnter,
|
key.CodeKeypadEnter: driver.KeyNumpadEnter,
|
||||||
key.CodeKeypad1: driver.KeyKP1,
|
key.CodeKeypad1: driver.KeyNumpad1,
|
||||||
key.CodeKeypad2: driver.KeyKP2,
|
key.CodeKeypad2: driver.KeyNumpad2,
|
||||||
key.CodeKeypad3: driver.KeyKP3,
|
key.CodeKeypad3: driver.KeyNumpad3,
|
||||||
key.CodeKeypad4: driver.KeyKP4,
|
key.CodeKeypad4: driver.KeyNumpad4,
|
||||||
key.CodeKeypad5: driver.KeyKP5,
|
key.CodeKeypad5: driver.KeyNumpad5,
|
||||||
key.CodeKeypad6: driver.KeyKP6,
|
key.CodeKeypad6: driver.KeyNumpad6,
|
||||||
key.CodeKeypad7: driver.KeyKP7,
|
key.CodeKeypad7: driver.KeyNumpad7,
|
||||||
key.CodeKeypad8: driver.KeyKP8,
|
key.CodeKeypad8: driver.KeyNumpad8,
|
||||||
key.CodeKeypad9: driver.KeyKP9,
|
key.CodeKeypad9: driver.KeyNumpad9,
|
||||||
key.CodeKeypad0: driver.KeyKP0,
|
key.CodeKeypad0: driver.KeyNumpad0,
|
||||||
key.CodeKeypadFullStop: driver.KeyKPDecimal,
|
key.CodeKeypadFullStop: driver.KeyNumpadDecimal,
|
||||||
key.CodeKeypadEqualSign: driver.KeyKPEqual,
|
key.CodeKeypadEqualSign: driver.KeyNumpadEqual,
|
||||||
key.CodeLeftControl: driver.KeyLeftControl,
|
key.CodeLeftControl: driver.KeyControlLeft,
|
||||||
key.CodeLeftShift: driver.KeyLeftShift,
|
key.CodeLeftShift: driver.KeyShiftLeft,
|
||||||
key.CodeLeftAlt: driver.KeyLeftAlt,
|
key.CodeLeftAlt: driver.KeyAltLeft,
|
||||||
key.CodeLeftGUI: driver.KeyLeftSuper,
|
key.CodeLeftGUI: driver.KeyMetaLeft,
|
||||||
key.CodeRightControl: driver.KeyRightControl,
|
key.CodeRightControl: driver.KeyControlRight,
|
||||||
key.CodeRightShift: driver.KeyRightShift,
|
key.CodeRightShift: driver.KeyShiftRight,
|
||||||
key.CodeRightAlt: driver.KeyRightAlt,
|
key.CodeRightAlt: driver.KeyAltRight,
|
||||||
key.CodeRightGUI: driver.KeyRightSuper,
|
key.CodeRightGUI: driver.KeyMetaRight,
|
||||||
}
|
}
|
||||||
|
716
keys.go
716
keys.go
@ -29,140 +29,158 @@ type Key int
|
|||||||
|
|
||||||
// Keys.
|
// Keys.
|
||||||
const (
|
const (
|
||||||
Key0 Key = Key(driver.Key0)
|
KeyA Key = Key(driver.KeyA)
|
||||||
Key1 Key = Key(driver.Key1)
|
KeyB Key = Key(driver.KeyB)
|
||||||
Key2 Key = Key(driver.Key2)
|
KeyC Key = Key(driver.KeyC)
|
||||||
Key3 Key = Key(driver.Key3)
|
KeyD Key = Key(driver.KeyD)
|
||||||
Key4 Key = Key(driver.Key4)
|
KeyE Key = Key(driver.KeyE)
|
||||||
Key5 Key = Key(driver.Key5)
|
KeyF Key = Key(driver.KeyF)
|
||||||
Key6 Key = Key(driver.Key6)
|
KeyG Key = Key(driver.KeyG)
|
||||||
Key7 Key = Key(driver.Key7)
|
KeyH Key = Key(driver.KeyH)
|
||||||
Key8 Key = Key(driver.Key8)
|
KeyI Key = Key(driver.KeyI)
|
||||||
Key9 Key = Key(driver.Key9)
|
KeyJ Key = Key(driver.KeyJ)
|
||||||
KeyA Key = Key(driver.KeyA)
|
KeyK Key = Key(driver.KeyK)
|
||||||
KeyB Key = Key(driver.KeyB)
|
KeyL Key = Key(driver.KeyL)
|
||||||
KeyC Key = Key(driver.KeyC)
|
KeyM Key = Key(driver.KeyM)
|
||||||
KeyD Key = Key(driver.KeyD)
|
KeyN Key = Key(driver.KeyN)
|
||||||
KeyE Key = Key(driver.KeyE)
|
KeyO Key = Key(driver.KeyO)
|
||||||
KeyF Key = Key(driver.KeyF)
|
KeyP Key = Key(driver.KeyP)
|
||||||
KeyG Key = Key(driver.KeyG)
|
KeyQ Key = Key(driver.KeyQ)
|
||||||
KeyH Key = Key(driver.KeyH)
|
KeyR Key = Key(driver.KeyR)
|
||||||
KeyI Key = Key(driver.KeyI)
|
KeyS Key = Key(driver.KeyS)
|
||||||
KeyJ Key = Key(driver.KeyJ)
|
KeyT Key = Key(driver.KeyT)
|
||||||
KeyK Key = Key(driver.KeyK)
|
KeyU Key = Key(driver.KeyU)
|
||||||
KeyL Key = Key(driver.KeyL)
|
KeyV Key = Key(driver.KeyV)
|
||||||
KeyM Key = Key(driver.KeyM)
|
KeyW Key = Key(driver.KeyW)
|
||||||
KeyN Key = Key(driver.KeyN)
|
KeyX Key = Key(driver.KeyX)
|
||||||
KeyO Key = Key(driver.KeyO)
|
KeyY Key = Key(driver.KeyY)
|
||||||
KeyP Key = Key(driver.KeyP)
|
KeyZ Key = Key(driver.KeyZ)
|
||||||
KeyQ Key = Key(driver.KeyQ)
|
KeyAltLeft Key = Key(driver.KeyAltLeft)
|
||||||
KeyR Key = Key(driver.KeyR)
|
KeyAltRight Key = Key(driver.KeyAltRight)
|
||||||
KeyS Key = Key(driver.KeyS)
|
KeyArrowDown Key = Key(driver.KeyArrowDown)
|
||||||
KeyT Key = Key(driver.KeyT)
|
KeyArrowLeft Key = Key(driver.KeyArrowLeft)
|
||||||
KeyU Key = Key(driver.KeyU)
|
KeyArrowRight Key = Key(driver.KeyArrowRight)
|
||||||
KeyV Key = Key(driver.KeyV)
|
KeyArrowUp Key = Key(driver.KeyArrowUp)
|
||||||
KeyW Key = Key(driver.KeyW)
|
KeyBackquote Key = Key(driver.KeyBackquote)
|
||||||
KeyX Key = Key(driver.KeyX)
|
KeyBackslash Key = Key(driver.KeyBackslash)
|
||||||
KeyY Key = Key(driver.KeyY)
|
KeyBackspace Key = Key(driver.KeyBackspace)
|
||||||
KeyZ Key = Key(driver.KeyZ)
|
KeyBracketLeft Key = Key(driver.KeyBracketLeft)
|
||||||
KeyApostrophe Key = Key(driver.KeyApostrophe)
|
KeyBracketRight Key = Key(driver.KeyBracketRight)
|
||||||
KeyBackslash Key = Key(driver.KeyBackslash)
|
KeyCapsLock Key = Key(driver.KeyCapsLock)
|
||||||
KeyBackspace Key = Key(driver.KeyBackspace)
|
KeyComma Key = Key(driver.KeyComma)
|
||||||
KeyCapsLock Key = Key(driver.KeyCapsLock)
|
KeyContextMenu Key = Key(driver.KeyContextMenu)
|
||||||
KeyComma Key = Key(driver.KeyComma)
|
KeyControlLeft Key = Key(driver.KeyControlLeft)
|
||||||
KeyDelete Key = Key(driver.KeyDelete)
|
KeyControlRight Key = Key(driver.KeyControlRight)
|
||||||
KeyDown Key = Key(driver.KeyDown)
|
KeyDelete Key = Key(driver.KeyDelete)
|
||||||
KeyEnd Key = Key(driver.KeyEnd)
|
KeyDigit0 Key = Key(driver.KeyDigit0)
|
||||||
KeyEnter Key = Key(driver.KeyEnter)
|
KeyDigit1 Key = Key(driver.KeyDigit1)
|
||||||
KeyEqual Key = Key(driver.KeyEqual)
|
KeyDigit2 Key = Key(driver.KeyDigit2)
|
||||||
KeyEscape Key = Key(driver.KeyEscape)
|
KeyDigit3 Key = Key(driver.KeyDigit3)
|
||||||
KeyF1 Key = Key(driver.KeyF1)
|
KeyDigit4 Key = Key(driver.KeyDigit4)
|
||||||
KeyF2 Key = Key(driver.KeyF2)
|
KeyDigit5 Key = Key(driver.KeyDigit5)
|
||||||
KeyF3 Key = Key(driver.KeyF3)
|
KeyDigit6 Key = Key(driver.KeyDigit6)
|
||||||
KeyF4 Key = Key(driver.KeyF4)
|
KeyDigit7 Key = Key(driver.KeyDigit7)
|
||||||
KeyF5 Key = Key(driver.KeyF5)
|
KeyDigit8 Key = Key(driver.KeyDigit8)
|
||||||
KeyF6 Key = Key(driver.KeyF6)
|
KeyDigit9 Key = Key(driver.KeyDigit9)
|
||||||
KeyF7 Key = Key(driver.KeyF7)
|
KeyEnd Key = Key(driver.KeyEnd)
|
||||||
KeyF8 Key = Key(driver.KeyF8)
|
KeyEnter Key = Key(driver.KeyEnter)
|
||||||
KeyF9 Key = Key(driver.KeyF9)
|
KeyEqual Key = Key(driver.KeyEqual)
|
||||||
KeyF10 Key = Key(driver.KeyF10)
|
KeyEscape Key = Key(driver.KeyEscape)
|
||||||
KeyF11 Key = Key(driver.KeyF11)
|
KeyF1 Key = Key(driver.KeyF1)
|
||||||
KeyF12 Key = Key(driver.KeyF12)
|
KeyF2 Key = Key(driver.KeyF2)
|
||||||
KeyGraveAccent Key = Key(driver.KeyGraveAccent)
|
KeyF3 Key = Key(driver.KeyF3)
|
||||||
KeyHome Key = Key(driver.KeyHome)
|
KeyF4 Key = Key(driver.KeyF4)
|
||||||
KeyInsert Key = Key(driver.KeyInsert)
|
KeyF5 Key = Key(driver.KeyF5)
|
||||||
KeyKP0 Key = Key(driver.KeyKP0)
|
KeyF6 Key = Key(driver.KeyF6)
|
||||||
KeyKP1 Key = Key(driver.KeyKP1)
|
KeyF7 Key = Key(driver.KeyF7)
|
||||||
KeyKP2 Key = Key(driver.KeyKP2)
|
KeyF8 Key = Key(driver.KeyF8)
|
||||||
KeyKP3 Key = Key(driver.KeyKP3)
|
KeyF9 Key = Key(driver.KeyF9)
|
||||||
KeyKP4 Key = Key(driver.KeyKP4)
|
KeyF10 Key = Key(driver.KeyF10)
|
||||||
KeyKP5 Key = Key(driver.KeyKP5)
|
KeyF11 Key = Key(driver.KeyF11)
|
||||||
KeyKP6 Key = Key(driver.KeyKP6)
|
KeyF12 Key = Key(driver.KeyF12)
|
||||||
KeyKP7 Key = Key(driver.KeyKP7)
|
KeyHome Key = Key(driver.KeyHome)
|
||||||
KeyKP8 Key = Key(driver.KeyKP8)
|
KeyInsert Key = Key(driver.KeyInsert)
|
||||||
KeyKP9 Key = Key(driver.KeyKP9)
|
KeyMetaLeft Key = Key(driver.KeyMetaLeft)
|
||||||
KeyKPAdd Key = Key(driver.KeyKPAdd)
|
KeyMetaRight Key = Key(driver.KeyMetaRight)
|
||||||
KeyKPDecimal Key = Key(driver.KeyKPDecimal)
|
KeyMinus Key = Key(driver.KeyMinus)
|
||||||
KeyKPDivide Key = Key(driver.KeyKPDivide)
|
KeyNumLock Key = Key(driver.KeyNumLock)
|
||||||
KeyKPEnter Key = Key(driver.KeyKPEnter)
|
KeyNumpad0 Key = Key(driver.KeyNumpad0)
|
||||||
KeyKPEqual Key = Key(driver.KeyKPEqual)
|
KeyNumpad1 Key = Key(driver.KeyNumpad1)
|
||||||
KeyKPMultiply Key = Key(driver.KeyKPMultiply)
|
KeyNumpad2 Key = Key(driver.KeyNumpad2)
|
||||||
KeyKPSubtract Key = Key(driver.KeyKPSubtract)
|
KeyNumpad3 Key = Key(driver.KeyNumpad3)
|
||||||
KeyLeft Key = Key(driver.KeyLeft)
|
KeyNumpad4 Key = Key(driver.KeyNumpad4)
|
||||||
KeyLeftAlt Key = Key(driver.KeyLeftAlt)
|
KeyNumpad5 Key = Key(driver.KeyNumpad5)
|
||||||
KeyLeftBracket Key = Key(driver.KeyLeftBracket)
|
KeyNumpad6 Key = Key(driver.KeyNumpad6)
|
||||||
KeyLeftControl Key = Key(driver.KeyLeftControl)
|
KeyNumpad7 Key = Key(driver.KeyNumpad7)
|
||||||
KeyLeftShift Key = Key(driver.KeyLeftShift)
|
KeyNumpad8 Key = Key(driver.KeyNumpad8)
|
||||||
KeyLeftSuper Key = Key(driver.KeyLeftSuper)
|
KeyNumpad9 Key = Key(driver.KeyNumpad9)
|
||||||
KeyMenu Key = Key(driver.KeyMenu)
|
KeyNumpadAdd Key = Key(driver.KeyNumpadAdd)
|
||||||
KeyMinus Key = Key(driver.KeyMinus)
|
KeyNumpadDecimal Key = Key(driver.KeyNumpadDecimal)
|
||||||
KeyNumLock Key = Key(driver.KeyNumLock)
|
KeyNumpadDivide Key = Key(driver.KeyNumpadDivide)
|
||||||
KeyPageDown Key = Key(driver.KeyPageDown)
|
KeyNumpadEnter Key = Key(driver.KeyNumpadEnter)
|
||||||
KeyPageUp Key = Key(driver.KeyPageUp)
|
KeyNumpadEqual Key = Key(driver.KeyNumpadEqual)
|
||||||
KeyPause Key = Key(driver.KeyPause)
|
KeyNumpadMultiply Key = Key(driver.KeyNumpadMultiply)
|
||||||
KeyPeriod Key = Key(driver.KeyPeriod)
|
KeyNumpadSubtract Key = Key(driver.KeyNumpadSubtract)
|
||||||
KeyPrintScreen Key = Key(driver.KeyPrintScreen)
|
KeyPageDown Key = Key(driver.KeyPageDown)
|
||||||
KeyRight Key = Key(driver.KeyRight)
|
KeyPageUp Key = Key(driver.KeyPageUp)
|
||||||
KeyRightAlt Key = Key(driver.KeyRightAlt)
|
KeyPause Key = Key(driver.KeyPause)
|
||||||
KeyRightBracket Key = Key(driver.KeyRightBracket)
|
KeyPeriod Key = Key(driver.KeyPeriod)
|
||||||
KeyRightControl Key = Key(driver.KeyRightControl)
|
KeyPrintScreen Key = Key(driver.KeyPrintScreen)
|
||||||
KeyRightShift Key = Key(driver.KeyRightShift)
|
KeyQuote Key = Key(driver.KeyQuote)
|
||||||
KeyRightSuper Key = Key(driver.KeyRightSuper)
|
KeyScrollLock Key = Key(driver.KeyScrollLock)
|
||||||
KeyScrollLock Key = Key(driver.KeyScrollLock)
|
KeySemicolon Key = Key(driver.KeySemicolon)
|
||||||
KeySemicolon Key = Key(driver.KeySemicolon)
|
KeyShiftLeft Key = Key(driver.KeyShiftLeft)
|
||||||
KeySlash Key = Key(driver.KeySlash)
|
KeyShiftRight Key = Key(driver.KeyShiftRight)
|
||||||
KeySpace Key = Key(driver.KeySpace)
|
KeySlash Key = Key(driver.KeySlash)
|
||||||
KeyTab Key = Key(driver.KeyTab)
|
KeySpace Key = Key(driver.KeySpace)
|
||||||
KeyUp Key = Key(driver.KeyUp)
|
KeyTab Key = Key(driver.KeyTab)
|
||||||
KeyAlt Key = Key(driver.KeyReserved0)
|
KeyAlt Key = Key(driver.KeyReserved0)
|
||||||
KeyControl Key = Key(driver.KeyReserved1)
|
KeyControl Key = Key(driver.KeyReserved1)
|
||||||
KeyShift Key = Key(driver.KeyReserved2)
|
KeyShift Key = Key(driver.KeyReserved2)
|
||||||
KeySuper Key = Key(driver.KeyReserved3)
|
KeyMeta Key = Key(driver.KeyReserved3)
|
||||||
KeyMax Key = KeySuper
|
KeyMax Key = KeyMeta
|
||||||
|
|
||||||
|
// Keys for backward compatibility.
|
||||||
|
// Deprecated: as of 2.1.0.
|
||||||
|
Key0 Key = Key(driver.KeyDigit0)
|
||||||
|
Key1 Key = Key(driver.KeyDigit1)
|
||||||
|
Key2 Key = Key(driver.KeyDigit2)
|
||||||
|
Key3 Key = Key(driver.KeyDigit3)
|
||||||
|
Key4 Key = Key(driver.KeyDigit4)
|
||||||
|
Key5 Key = Key(driver.KeyDigit5)
|
||||||
|
Key6 Key = Key(driver.KeyDigit6)
|
||||||
|
Key7 Key = Key(driver.KeyDigit7)
|
||||||
|
Key8 Key = Key(driver.KeyDigit8)
|
||||||
|
Key9 Key = Key(driver.KeyDigit9)
|
||||||
|
KeyApostrophe Key = Key(driver.KeyQuote)
|
||||||
|
KeyDown Key = Key(driver.KeyArrowDown)
|
||||||
|
KeyGraveAccent Key = Key(driver.KeyBackquote)
|
||||||
|
KeyKP0 Key = Key(driver.KeyNumpad0)
|
||||||
|
KeyKP1 Key = Key(driver.KeyNumpad1)
|
||||||
|
KeyKP2 Key = Key(driver.KeyNumpad2)
|
||||||
|
KeyKP3 Key = Key(driver.KeyNumpad3)
|
||||||
|
KeyKP4 Key = Key(driver.KeyNumpad4)
|
||||||
|
KeyKP5 Key = Key(driver.KeyNumpad5)
|
||||||
|
KeyKP6 Key = Key(driver.KeyNumpad6)
|
||||||
|
KeyKP7 Key = Key(driver.KeyNumpad7)
|
||||||
|
KeyKP8 Key = Key(driver.KeyNumpad8)
|
||||||
|
KeyKP9 Key = Key(driver.KeyNumpad9)
|
||||||
|
KeyKPDecimal Key = Key(driver.KeyNumpadDecimal)
|
||||||
|
KeyKPDivide Key = Key(driver.KeyNumpadDivide)
|
||||||
|
KeyKPEnter Key = Key(driver.KeyNumpadEnter)
|
||||||
|
KeyKPEqual Key = Key(driver.KeyNumpadEqual)
|
||||||
|
KeyKPMultiply Key = Key(driver.KeyNumpadMultiply)
|
||||||
|
KeyKPSubtract Key = Key(driver.KeyNumpadSubtract)
|
||||||
|
KeyLeft Key = Key(driver.KeyArrowLeft)
|
||||||
|
KeyLeftBracket Key = Key(driver.KeyBracketLeft)
|
||||||
|
KeyMenu Key = Key(driver.KeyContextMenu)
|
||||||
|
KeyRight Key = Key(driver.KeyArrowRight)
|
||||||
|
KeyRightBracket Key = Key(driver.KeyBracketRight)
|
||||||
|
KeyUp Key = Key(driver.KeyArrowUp)
|
||||||
)
|
)
|
||||||
|
|
||||||
func (k Key) isValid() bool {
|
func (k Key) isValid() bool {
|
||||||
switch k {
|
switch k {
|
||||||
case Key0:
|
|
||||||
return true
|
|
||||||
case Key1:
|
|
||||||
return true
|
|
||||||
case Key2:
|
|
||||||
return true
|
|
||||||
case Key3:
|
|
||||||
return true
|
|
||||||
case Key4:
|
|
||||||
return true
|
|
||||||
case Key5:
|
|
||||||
return true
|
|
||||||
case Key6:
|
|
||||||
return true
|
|
||||||
case Key7:
|
|
||||||
return true
|
|
||||||
case Key8:
|
|
||||||
return true
|
|
||||||
case Key9:
|
|
||||||
return true
|
|
||||||
case KeyA:
|
case KeyA:
|
||||||
return true
|
return true
|
||||||
case KeyB:
|
case KeyB:
|
||||||
@ -217,21 +235,61 @@ func (k Key) isValid() bool {
|
|||||||
return true
|
return true
|
||||||
case KeyAlt:
|
case KeyAlt:
|
||||||
return true
|
return true
|
||||||
case KeyApostrophe:
|
case KeyAltLeft:
|
||||||
|
return true
|
||||||
|
case KeyAltRight:
|
||||||
|
return true
|
||||||
|
case KeyArrowDown:
|
||||||
|
return true
|
||||||
|
case KeyArrowLeft:
|
||||||
|
return true
|
||||||
|
case KeyArrowRight:
|
||||||
|
return true
|
||||||
|
case KeyArrowUp:
|
||||||
|
return true
|
||||||
|
case KeyBackquote:
|
||||||
return true
|
return true
|
||||||
case KeyBackslash:
|
case KeyBackslash:
|
||||||
return true
|
return true
|
||||||
case KeyBackspace:
|
case KeyBackspace:
|
||||||
return true
|
return true
|
||||||
|
case KeyBracketLeft:
|
||||||
|
return true
|
||||||
|
case KeyBracketRight:
|
||||||
|
return true
|
||||||
case KeyCapsLock:
|
case KeyCapsLock:
|
||||||
return true
|
return true
|
||||||
case KeyComma:
|
case KeyComma:
|
||||||
return true
|
return true
|
||||||
|
case KeyContextMenu:
|
||||||
|
return true
|
||||||
case KeyControl:
|
case KeyControl:
|
||||||
return true
|
return true
|
||||||
|
case KeyControlLeft:
|
||||||
|
return true
|
||||||
|
case KeyControlRight:
|
||||||
|
return true
|
||||||
case KeyDelete:
|
case KeyDelete:
|
||||||
return true
|
return true
|
||||||
case KeyDown:
|
case KeyDigit0:
|
||||||
|
return true
|
||||||
|
case KeyDigit1:
|
||||||
|
return true
|
||||||
|
case KeyDigit2:
|
||||||
|
return true
|
||||||
|
case KeyDigit3:
|
||||||
|
return true
|
||||||
|
case KeyDigit4:
|
||||||
|
return true
|
||||||
|
case KeyDigit5:
|
||||||
|
return true
|
||||||
|
case KeyDigit6:
|
||||||
|
return true
|
||||||
|
case KeyDigit7:
|
||||||
|
return true
|
||||||
|
case KeyDigit8:
|
||||||
|
return true
|
||||||
|
case KeyDigit9:
|
||||||
return true
|
return true
|
||||||
case KeyEnd:
|
case KeyEnd:
|
||||||
return true
|
return true
|
||||||
@ -265,64 +323,54 @@ func (k Key) isValid() bool {
|
|||||||
return true
|
return true
|
||||||
case KeyF12:
|
case KeyF12:
|
||||||
return true
|
return true
|
||||||
case KeyGraveAccent:
|
|
||||||
return true
|
|
||||||
case KeyHome:
|
case KeyHome:
|
||||||
return true
|
return true
|
||||||
case KeyInsert:
|
case KeyInsert:
|
||||||
return true
|
return true
|
||||||
case KeyKP0:
|
case KeyMeta:
|
||||||
return true
|
return true
|
||||||
case KeyKP1:
|
case KeyMetaLeft:
|
||||||
return true
|
return true
|
||||||
case KeyKP2:
|
case KeyMetaRight:
|
||||||
return true
|
|
||||||
case KeyKP3:
|
|
||||||
return true
|
|
||||||
case KeyKP4:
|
|
||||||
return true
|
|
||||||
case KeyKP5:
|
|
||||||
return true
|
|
||||||
case KeyKP6:
|
|
||||||
return true
|
|
||||||
case KeyKP7:
|
|
||||||
return true
|
|
||||||
case KeyKP8:
|
|
||||||
return true
|
|
||||||
case KeyKP9:
|
|
||||||
return true
|
|
||||||
case KeyKPAdd:
|
|
||||||
return true
|
|
||||||
case KeyKPDecimal:
|
|
||||||
return true
|
|
||||||
case KeyKPDivide:
|
|
||||||
return true
|
|
||||||
case KeyKPEnter:
|
|
||||||
return true
|
|
||||||
case KeyKPEqual:
|
|
||||||
return true
|
|
||||||
case KeyKPMultiply:
|
|
||||||
return true
|
|
||||||
case KeyKPSubtract:
|
|
||||||
return true
|
|
||||||
case KeyLeft:
|
|
||||||
return true
|
|
||||||
case KeyLeftAlt:
|
|
||||||
return true
|
|
||||||
case KeyLeftBracket:
|
|
||||||
return true
|
|
||||||
case KeyLeftControl:
|
|
||||||
return true
|
|
||||||
case KeyLeftShift:
|
|
||||||
return true
|
|
||||||
case KeyLeftSuper:
|
|
||||||
return true
|
|
||||||
case KeyMenu:
|
|
||||||
return true
|
return true
|
||||||
case KeyMinus:
|
case KeyMinus:
|
||||||
return true
|
return true
|
||||||
case KeyNumLock:
|
case KeyNumLock:
|
||||||
return true
|
return true
|
||||||
|
case KeyNumpad0:
|
||||||
|
return true
|
||||||
|
case KeyNumpad1:
|
||||||
|
return true
|
||||||
|
case KeyNumpad2:
|
||||||
|
return true
|
||||||
|
case KeyNumpad3:
|
||||||
|
return true
|
||||||
|
case KeyNumpad4:
|
||||||
|
return true
|
||||||
|
case KeyNumpad5:
|
||||||
|
return true
|
||||||
|
case KeyNumpad6:
|
||||||
|
return true
|
||||||
|
case KeyNumpad7:
|
||||||
|
return true
|
||||||
|
case KeyNumpad8:
|
||||||
|
return true
|
||||||
|
case KeyNumpad9:
|
||||||
|
return true
|
||||||
|
case KeyNumpadAdd:
|
||||||
|
return true
|
||||||
|
case KeyNumpadDecimal:
|
||||||
|
return true
|
||||||
|
case KeyNumpadDivide:
|
||||||
|
return true
|
||||||
|
case KeyNumpadEnter:
|
||||||
|
return true
|
||||||
|
case KeyNumpadEqual:
|
||||||
|
return true
|
||||||
|
case KeyNumpadMultiply:
|
||||||
|
return true
|
||||||
|
case KeyNumpadSubtract:
|
||||||
|
return true
|
||||||
case KeyPageDown:
|
case KeyPageDown:
|
||||||
return true
|
return true
|
||||||
case KeyPageUp:
|
case KeyPageUp:
|
||||||
@ -333,17 +381,7 @@ func (k Key) isValid() bool {
|
|||||||
return true
|
return true
|
||||||
case KeyPrintScreen:
|
case KeyPrintScreen:
|
||||||
return true
|
return true
|
||||||
case KeyRight:
|
case KeyQuote:
|
||||||
return true
|
|
||||||
case KeyRightAlt:
|
|
||||||
return true
|
|
||||||
case KeyRightBracket:
|
|
||||||
return true
|
|
||||||
case KeyRightControl:
|
|
||||||
return true
|
|
||||||
case KeyRightShift:
|
|
||||||
return true
|
|
||||||
case KeyRightSuper:
|
|
||||||
return true
|
return true
|
||||||
case KeyScrollLock:
|
case KeyScrollLock:
|
||||||
return true
|
return true
|
||||||
@ -351,16 +389,16 @@ func (k Key) isValid() bool {
|
|||||||
return true
|
return true
|
||||||
case KeyShift:
|
case KeyShift:
|
||||||
return true
|
return true
|
||||||
|
case KeyShiftLeft:
|
||||||
|
return true
|
||||||
|
case KeyShiftRight:
|
||||||
|
return true
|
||||||
case KeySlash:
|
case KeySlash:
|
||||||
return true
|
return true
|
||||||
case KeySpace:
|
case KeySpace:
|
||||||
return true
|
return true
|
||||||
case KeySuper:
|
|
||||||
return true
|
|
||||||
case KeyTab:
|
case KeyTab:
|
||||||
return true
|
return true
|
||||||
case KeyUp:
|
|
||||||
return true
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
@ -372,26 +410,6 @@ func (k Key) isValid() bool {
|
|||||||
// If k is an undefined key, String returns an empty string.
|
// If k is an undefined key, String returns an empty string.
|
||||||
func (k Key) String() string {
|
func (k Key) String() string {
|
||||||
switch k {
|
switch k {
|
||||||
case Key0:
|
|
||||||
return "0"
|
|
||||||
case Key1:
|
|
||||||
return "1"
|
|
||||||
case Key2:
|
|
||||||
return "2"
|
|
||||||
case Key3:
|
|
||||||
return "3"
|
|
||||||
case Key4:
|
|
||||||
return "4"
|
|
||||||
case Key5:
|
|
||||||
return "5"
|
|
||||||
case Key6:
|
|
||||||
return "6"
|
|
||||||
case Key7:
|
|
||||||
return "7"
|
|
||||||
case Key8:
|
|
||||||
return "8"
|
|
||||||
case Key9:
|
|
||||||
return "9"
|
|
||||||
case KeyA:
|
case KeyA:
|
||||||
return "A"
|
return "A"
|
||||||
case KeyB:
|
case KeyB:
|
||||||
@ -446,22 +464,62 @@ func (k Key) String() string {
|
|||||||
return "Z"
|
return "Z"
|
||||||
case KeyAlt:
|
case KeyAlt:
|
||||||
return "Alt"
|
return "Alt"
|
||||||
case KeyApostrophe:
|
case KeyAltLeft:
|
||||||
return "Apostrophe"
|
return "AltLeft"
|
||||||
|
case KeyAltRight:
|
||||||
|
return "AltRight"
|
||||||
|
case KeyArrowDown:
|
||||||
|
return "ArrowDown"
|
||||||
|
case KeyArrowLeft:
|
||||||
|
return "ArrowLeft"
|
||||||
|
case KeyArrowRight:
|
||||||
|
return "ArrowRight"
|
||||||
|
case KeyArrowUp:
|
||||||
|
return "ArrowUp"
|
||||||
|
case KeyBackquote:
|
||||||
|
return "Backquote"
|
||||||
case KeyBackslash:
|
case KeyBackslash:
|
||||||
return "Backslash"
|
return "Backslash"
|
||||||
case KeyBackspace:
|
case KeyBackspace:
|
||||||
return "Backspace"
|
return "Backspace"
|
||||||
|
case KeyBracketLeft:
|
||||||
|
return "BracketLeft"
|
||||||
|
case KeyBracketRight:
|
||||||
|
return "BracketRight"
|
||||||
case KeyCapsLock:
|
case KeyCapsLock:
|
||||||
return "CapsLock"
|
return "CapsLock"
|
||||||
case KeyComma:
|
case KeyComma:
|
||||||
return "Comma"
|
return "Comma"
|
||||||
|
case KeyContextMenu:
|
||||||
|
return "ContextMenu"
|
||||||
case KeyControl:
|
case KeyControl:
|
||||||
return "Control"
|
return "Control"
|
||||||
|
case KeyControlLeft:
|
||||||
|
return "ControlLeft"
|
||||||
|
case KeyControlRight:
|
||||||
|
return "ControlRight"
|
||||||
case KeyDelete:
|
case KeyDelete:
|
||||||
return "Delete"
|
return "Delete"
|
||||||
case KeyDown:
|
case KeyDigit0:
|
||||||
return "Down"
|
return "Digit0"
|
||||||
|
case KeyDigit1:
|
||||||
|
return "Digit1"
|
||||||
|
case KeyDigit2:
|
||||||
|
return "Digit2"
|
||||||
|
case KeyDigit3:
|
||||||
|
return "Digit3"
|
||||||
|
case KeyDigit4:
|
||||||
|
return "Digit4"
|
||||||
|
case KeyDigit5:
|
||||||
|
return "Digit5"
|
||||||
|
case KeyDigit6:
|
||||||
|
return "Digit6"
|
||||||
|
case KeyDigit7:
|
||||||
|
return "Digit7"
|
||||||
|
case KeyDigit8:
|
||||||
|
return "Digit8"
|
||||||
|
case KeyDigit9:
|
||||||
|
return "Digit9"
|
||||||
case KeyEnd:
|
case KeyEnd:
|
||||||
return "End"
|
return "End"
|
||||||
case KeyEnter:
|
case KeyEnter:
|
||||||
@ -494,64 +552,54 @@ func (k Key) String() string {
|
|||||||
return "F11"
|
return "F11"
|
||||||
case KeyF12:
|
case KeyF12:
|
||||||
return "F12"
|
return "F12"
|
||||||
case KeyGraveAccent:
|
|
||||||
return "GraveAccent"
|
|
||||||
case KeyHome:
|
case KeyHome:
|
||||||
return "Home"
|
return "Home"
|
||||||
case KeyInsert:
|
case KeyInsert:
|
||||||
return "Insert"
|
return "Insert"
|
||||||
case KeyKP0:
|
case KeyMeta:
|
||||||
return "KP0"
|
return "Meta"
|
||||||
case KeyKP1:
|
case KeyMetaLeft:
|
||||||
return "KP1"
|
return "MetaLeft"
|
||||||
case KeyKP2:
|
case KeyMetaRight:
|
||||||
return "KP2"
|
return "MetaRight"
|
||||||
case KeyKP3:
|
|
||||||
return "KP3"
|
|
||||||
case KeyKP4:
|
|
||||||
return "KP4"
|
|
||||||
case KeyKP5:
|
|
||||||
return "KP5"
|
|
||||||
case KeyKP6:
|
|
||||||
return "KP6"
|
|
||||||
case KeyKP7:
|
|
||||||
return "KP7"
|
|
||||||
case KeyKP8:
|
|
||||||
return "KP8"
|
|
||||||
case KeyKP9:
|
|
||||||
return "KP9"
|
|
||||||
case KeyKPAdd:
|
|
||||||
return "KPAdd"
|
|
||||||
case KeyKPDecimal:
|
|
||||||
return "KPDecimal"
|
|
||||||
case KeyKPDivide:
|
|
||||||
return "KPDivide"
|
|
||||||
case KeyKPEnter:
|
|
||||||
return "KPEnter"
|
|
||||||
case KeyKPEqual:
|
|
||||||
return "KPEqual"
|
|
||||||
case KeyKPMultiply:
|
|
||||||
return "KPMultiply"
|
|
||||||
case KeyKPSubtract:
|
|
||||||
return "KPSubtract"
|
|
||||||
case KeyLeft:
|
|
||||||
return "Left"
|
|
||||||
case KeyLeftAlt:
|
|
||||||
return "LeftAlt"
|
|
||||||
case KeyLeftBracket:
|
|
||||||
return "LeftBracket"
|
|
||||||
case KeyLeftControl:
|
|
||||||
return "LeftControl"
|
|
||||||
case KeyLeftShift:
|
|
||||||
return "LeftShift"
|
|
||||||
case KeyLeftSuper:
|
|
||||||
return "LeftSuper"
|
|
||||||
case KeyMenu:
|
|
||||||
return "Menu"
|
|
||||||
case KeyMinus:
|
case KeyMinus:
|
||||||
return "Minus"
|
return "Minus"
|
||||||
case KeyNumLock:
|
case KeyNumLock:
|
||||||
return "NumLock"
|
return "NumLock"
|
||||||
|
case KeyNumpad0:
|
||||||
|
return "Numpad0"
|
||||||
|
case KeyNumpad1:
|
||||||
|
return "Numpad1"
|
||||||
|
case KeyNumpad2:
|
||||||
|
return "Numpad2"
|
||||||
|
case KeyNumpad3:
|
||||||
|
return "Numpad3"
|
||||||
|
case KeyNumpad4:
|
||||||
|
return "Numpad4"
|
||||||
|
case KeyNumpad5:
|
||||||
|
return "Numpad5"
|
||||||
|
case KeyNumpad6:
|
||||||
|
return "Numpad6"
|
||||||
|
case KeyNumpad7:
|
||||||
|
return "Numpad7"
|
||||||
|
case KeyNumpad8:
|
||||||
|
return "Numpad8"
|
||||||
|
case KeyNumpad9:
|
||||||
|
return "Numpad9"
|
||||||
|
case KeyNumpadAdd:
|
||||||
|
return "NumpadAdd"
|
||||||
|
case KeyNumpadDecimal:
|
||||||
|
return "NumpadDecimal"
|
||||||
|
case KeyNumpadDivide:
|
||||||
|
return "NumpadDivide"
|
||||||
|
case KeyNumpadEnter:
|
||||||
|
return "NumpadEnter"
|
||||||
|
case KeyNumpadEqual:
|
||||||
|
return "NumpadEqual"
|
||||||
|
case KeyNumpadMultiply:
|
||||||
|
return "NumpadMultiply"
|
||||||
|
case KeyNumpadSubtract:
|
||||||
|
return "NumpadSubtract"
|
||||||
case KeyPageDown:
|
case KeyPageDown:
|
||||||
return "PageDown"
|
return "PageDown"
|
||||||
case KeyPageUp:
|
case KeyPageUp:
|
||||||
@ -562,34 +610,24 @@ func (k Key) String() string {
|
|||||||
return "Period"
|
return "Period"
|
||||||
case KeyPrintScreen:
|
case KeyPrintScreen:
|
||||||
return "PrintScreen"
|
return "PrintScreen"
|
||||||
case KeyRight:
|
case KeyQuote:
|
||||||
return "Right"
|
return "Quote"
|
||||||
case KeyRightAlt:
|
|
||||||
return "RightAlt"
|
|
||||||
case KeyRightBracket:
|
|
||||||
return "RightBracket"
|
|
||||||
case KeyRightControl:
|
|
||||||
return "RightControl"
|
|
||||||
case KeyRightShift:
|
|
||||||
return "RightShift"
|
|
||||||
case KeyRightSuper:
|
|
||||||
return "RightSuper"
|
|
||||||
case KeyScrollLock:
|
case KeyScrollLock:
|
||||||
return "ScrollLock"
|
return "ScrollLock"
|
||||||
case KeySemicolon:
|
case KeySemicolon:
|
||||||
return "Semicolon"
|
return "Semicolon"
|
||||||
case KeyShift:
|
case KeyShift:
|
||||||
return "Shift"
|
return "Shift"
|
||||||
|
case KeyShiftLeft:
|
||||||
|
return "ShiftLeft"
|
||||||
|
case KeyShiftRight:
|
||||||
|
return "ShiftRight"
|
||||||
case KeySlash:
|
case KeySlash:
|
||||||
return "Slash"
|
return "Slash"
|
||||||
case KeySpace:
|
case KeySpace:
|
||||||
return "Space"
|
return "Space"
|
||||||
case KeySuper:
|
|
||||||
return "Super"
|
|
||||||
case KeyTab:
|
case KeyTab:
|
||||||
return "Tab"
|
return "Tab"
|
||||||
case KeyUp:
|
|
||||||
return "Up"
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -670,20 +708,64 @@ func keyNameToKeyCode(name string) (Key, bool) {
|
|||||||
return KeyZ, true
|
return KeyZ, true
|
||||||
case "alt":
|
case "alt":
|
||||||
return KeyAlt, true
|
return KeyAlt, true
|
||||||
|
case "altleft":
|
||||||
|
return KeyAltLeft, true
|
||||||
|
case "altright":
|
||||||
|
return KeyAltRight, true
|
||||||
case "apostrophe":
|
case "apostrophe":
|
||||||
return KeyApostrophe, true
|
return KeyApostrophe, true
|
||||||
|
case "arrowdown":
|
||||||
|
return KeyArrowDown, true
|
||||||
|
case "arrowleft":
|
||||||
|
return KeyArrowLeft, true
|
||||||
|
case "arrowright":
|
||||||
|
return KeyArrowRight, true
|
||||||
|
case "arrowup":
|
||||||
|
return KeyArrowUp, true
|
||||||
|
case "backquote":
|
||||||
|
return KeyBackquote, true
|
||||||
case "backslash":
|
case "backslash":
|
||||||
return KeyBackslash, true
|
return KeyBackslash, true
|
||||||
case "backspace":
|
case "backspace":
|
||||||
return KeyBackspace, true
|
return KeyBackspace, true
|
||||||
|
case "bracketleft":
|
||||||
|
return KeyBracketLeft, true
|
||||||
|
case "bracketright":
|
||||||
|
return KeyBracketRight, true
|
||||||
case "capslock":
|
case "capslock":
|
||||||
return KeyCapsLock, true
|
return KeyCapsLock, true
|
||||||
case "comma":
|
case "comma":
|
||||||
return KeyComma, true
|
return KeyComma, true
|
||||||
|
case "contextmenu":
|
||||||
|
return KeyContextMenu, true
|
||||||
case "control":
|
case "control":
|
||||||
return KeyControl, true
|
return KeyControl, true
|
||||||
|
case "controlleft":
|
||||||
|
return KeyControlLeft, true
|
||||||
|
case "controlright":
|
||||||
|
return KeyControlRight, true
|
||||||
case "delete":
|
case "delete":
|
||||||
return KeyDelete, true
|
return KeyDelete, true
|
||||||
|
case "digit0":
|
||||||
|
return KeyDigit0, true
|
||||||
|
case "digit1":
|
||||||
|
return KeyDigit1, true
|
||||||
|
case "digit2":
|
||||||
|
return KeyDigit2, true
|
||||||
|
case "digit3":
|
||||||
|
return KeyDigit3, true
|
||||||
|
case "digit4":
|
||||||
|
return KeyDigit4, true
|
||||||
|
case "digit5":
|
||||||
|
return KeyDigit5, true
|
||||||
|
case "digit6":
|
||||||
|
return KeyDigit6, true
|
||||||
|
case "digit7":
|
||||||
|
return KeyDigit7, true
|
||||||
|
case "digit8":
|
||||||
|
return KeyDigit8, true
|
||||||
|
case "digit9":
|
||||||
|
return KeyDigit9, true
|
||||||
case "down":
|
case "down":
|
||||||
return KeyDown, true
|
return KeyDown, true
|
||||||
case "end":
|
case "end":
|
||||||
@ -744,8 +826,6 @@ func keyNameToKeyCode(name string) (Key, bool) {
|
|||||||
return KeyKP8, true
|
return KeyKP8, true
|
||||||
case "kp9":
|
case "kp9":
|
||||||
return KeyKP9, true
|
return KeyKP9, true
|
||||||
case "kpadd":
|
|
||||||
return KeyKPAdd, true
|
|
||||||
case "kpdecimal":
|
case "kpdecimal":
|
||||||
return KeyKPDecimal, true
|
return KeyKPDecimal, true
|
||||||
case "kpdivide":
|
case "kpdivide":
|
||||||
@ -760,22 +840,54 @@ func keyNameToKeyCode(name string) (Key, bool) {
|
|||||||
return KeyKPSubtract, true
|
return KeyKPSubtract, true
|
||||||
case "left":
|
case "left":
|
||||||
return KeyLeft, true
|
return KeyLeft, true
|
||||||
case "leftalt":
|
|
||||||
return KeyLeftAlt, true
|
|
||||||
case "leftbracket":
|
case "leftbracket":
|
||||||
return KeyLeftBracket, true
|
return KeyLeftBracket, true
|
||||||
case "leftcontrol":
|
|
||||||
return KeyLeftControl, true
|
|
||||||
case "leftshift":
|
|
||||||
return KeyLeftShift, true
|
|
||||||
case "leftsuper":
|
|
||||||
return KeyLeftSuper, true
|
|
||||||
case "menu":
|
case "menu":
|
||||||
return KeyMenu, true
|
return KeyMenu, true
|
||||||
|
case "meta":
|
||||||
|
return KeyMeta, true
|
||||||
|
case "metaleft":
|
||||||
|
return KeyMetaLeft, true
|
||||||
|
case "metaright":
|
||||||
|
return KeyMetaRight, true
|
||||||
case "minus":
|
case "minus":
|
||||||
return KeyMinus, true
|
return KeyMinus, true
|
||||||
case "numlock":
|
case "numlock":
|
||||||
return KeyNumLock, true
|
return KeyNumLock, true
|
||||||
|
case "numpad0":
|
||||||
|
return KeyNumpad0, true
|
||||||
|
case "numpad1":
|
||||||
|
return KeyNumpad1, true
|
||||||
|
case "numpad2":
|
||||||
|
return KeyNumpad2, true
|
||||||
|
case "numpad3":
|
||||||
|
return KeyNumpad3, true
|
||||||
|
case "numpad4":
|
||||||
|
return KeyNumpad4, true
|
||||||
|
case "numpad5":
|
||||||
|
return KeyNumpad5, true
|
||||||
|
case "numpad6":
|
||||||
|
return KeyNumpad6, true
|
||||||
|
case "numpad7":
|
||||||
|
return KeyNumpad7, true
|
||||||
|
case "numpad8":
|
||||||
|
return KeyNumpad8, true
|
||||||
|
case "numpad9":
|
||||||
|
return KeyNumpad9, true
|
||||||
|
case "numpadadd":
|
||||||
|
return KeyNumpadAdd, true
|
||||||
|
case "numpaddecimal":
|
||||||
|
return KeyNumpadDecimal, true
|
||||||
|
case "numpaddivide":
|
||||||
|
return KeyNumpadDivide, true
|
||||||
|
case "numpadenter":
|
||||||
|
return KeyNumpadEnter, true
|
||||||
|
case "numpadequal":
|
||||||
|
return KeyNumpadEqual, true
|
||||||
|
case "numpadmultiply":
|
||||||
|
return KeyNumpadMultiply, true
|
||||||
|
case "numpadsubtract":
|
||||||
|
return KeyNumpadSubtract, true
|
||||||
case "pagedown":
|
case "pagedown":
|
||||||
return KeyPageDown, true
|
return KeyPageDown, true
|
||||||
case "pageup":
|
case "pageup":
|
||||||
@ -786,30 +898,26 @@ func keyNameToKeyCode(name string) (Key, bool) {
|
|||||||
return KeyPeriod, true
|
return KeyPeriod, true
|
||||||
case "printscreen":
|
case "printscreen":
|
||||||
return KeyPrintScreen, true
|
return KeyPrintScreen, true
|
||||||
|
case "quote":
|
||||||
|
return KeyQuote, true
|
||||||
case "right":
|
case "right":
|
||||||
return KeyRight, true
|
return KeyRight, true
|
||||||
case "rightalt":
|
|
||||||
return KeyRightAlt, true
|
|
||||||
case "rightbracket":
|
case "rightbracket":
|
||||||
return KeyRightBracket, true
|
return KeyRightBracket, true
|
||||||
case "rightcontrol":
|
|
||||||
return KeyRightControl, true
|
|
||||||
case "rightshift":
|
|
||||||
return KeyRightShift, true
|
|
||||||
case "rightsuper":
|
|
||||||
return KeyRightSuper, true
|
|
||||||
case "scrolllock":
|
case "scrolllock":
|
||||||
return KeyScrollLock, true
|
return KeyScrollLock, true
|
||||||
case "semicolon":
|
case "semicolon":
|
||||||
return KeySemicolon, true
|
return KeySemicolon, true
|
||||||
case "shift":
|
case "shift":
|
||||||
return KeyShift, true
|
return KeyShift, true
|
||||||
|
case "shiftleft":
|
||||||
|
return KeyShiftLeft, true
|
||||||
|
case "shiftright":
|
||||||
|
return KeyShiftRight, true
|
||||||
case "slash":
|
case "slash":
|
||||||
return KeySlash, true
|
return KeySlash, true
|
||||||
case "space":
|
case "space":
|
||||||
return KeySpace, true
|
return KeySpace, true
|
||||||
case "super":
|
|
||||||
return KeySuper, true
|
|
||||||
case "tab":
|
case "tab":
|
||||||
return KeyTab, true
|
return KeyTab, true
|
||||||
case "up":
|
case "up":
|
||||||
|
@ -21,20 +21,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var androidKeyToDriverKey = map[int]driver.Key{
|
var androidKeyToDriverKey = map[int]driver.Key{
|
||||||
7: driver.Key0,
|
7: driver.KeyDigit0,
|
||||||
8: driver.Key1,
|
8: driver.KeyDigit1,
|
||||||
9: driver.Key2,
|
9: driver.KeyDigit2,
|
||||||
10: driver.Key3,
|
10: driver.KeyDigit3,
|
||||||
11: driver.Key4,
|
11: driver.KeyDigit4,
|
||||||
12: driver.Key5,
|
12: driver.KeyDigit5,
|
||||||
13: driver.Key6,
|
13: driver.KeyDigit6,
|
||||||
14: driver.Key7,
|
14: driver.KeyDigit7,
|
||||||
15: driver.Key8,
|
15: driver.KeyDigit8,
|
||||||
16: driver.Key9,
|
16: driver.KeyDigit9,
|
||||||
19: driver.KeyUp,
|
19: driver.KeyArrowUp,
|
||||||
20: driver.KeyDown,
|
20: driver.KeyArrowDown,
|
||||||
21: driver.KeyLeft,
|
21: driver.KeyArrowLeft,
|
||||||
22: driver.KeyRight,
|
22: driver.KeyArrowRight,
|
||||||
29: driver.KeyA,
|
29: driver.KeyA,
|
||||||
30: driver.KeyB,
|
30: driver.KeyB,
|
||||||
31: driver.KeyC,
|
31: driver.KeyC,
|
||||||
@ -63,34 +63,34 @@ var androidKeyToDriverKey = map[int]driver.Key{
|
|||||||
54: driver.KeyZ,
|
54: driver.KeyZ,
|
||||||
55: driver.KeyComma,
|
55: driver.KeyComma,
|
||||||
56: driver.KeyPeriod,
|
56: driver.KeyPeriod,
|
||||||
57: driver.KeyLeftAlt,
|
57: driver.KeyAltLeft,
|
||||||
58: driver.KeyRightAlt,
|
58: driver.KeyAltRight,
|
||||||
59: driver.KeyLeftShift,
|
59: driver.KeyShiftLeft,
|
||||||
60: driver.KeyRightShift,
|
60: driver.KeyShiftRight,
|
||||||
61: driver.KeyTab,
|
61: driver.KeyTab,
|
||||||
62: driver.KeySpace,
|
62: driver.KeySpace,
|
||||||
66: driver.KeyEnter,
|
66: driver.KeyEnter,
|
||||||
67: driver.KeyBackspace,
|
67: driver.KeyBackspace,
|
||||||
68: driver.KeyGraveAccent,
|
68: driver.KeyBackquote,
|
||||||
69: driver.KeyMinus,
|
69: driver.KeyMinus,
|
||||||
70: driver.KeyEqual,
|
70: driver.KeyEqual,
|
||||||
71: driver.KeyLeftBracket,
|
71: driver.KeyBracketLeft,
|
||||||
72: driver.KeyRightBracket,
|
72: driver.KeyBracketRight,
|
||||||
73: driver.KeyBackslash,
|
73: driver.KeyBackslash,
|
||||||
74: driver.KeySemicolon,
|
74: driver.KeySemicolon,
|
||||||
75: driver.KeyApostrophe,
|
75: driver.KeyQuote,
|
||||||
76: driver.KeySlash,
|
76: driver.KeySlash,
|
||||||
82: driver.KeyMenu,
|
82: driver.KeyContextMenu,
|
||||||
92: driver.KeyPageUp,
|
92: driver.KeyPageUp,
|
||||||
93: driver.KeyPageDown,
|
93: driver.KeyPageDown,
|
||||||
111: driver.KeyEscape,
|
111: driver.KeyEscape,
|
||||||
112: driver.KeyDelete,
|
112: driver.KeyDelete,
|
||||||
113: driver.KeyLeftControl,
|
113: driver.KeyControlLeft,
|
||||||
114: driver.KeyRightControl,
|
114: driver.KeyControlRight,
|
||||||
115: driver.KeyCapsLock,
|
115: driver.KeyCapsLock,
|
||||||
116: driver.KeyScrollLock,
|
116: driver.KeyScrollLock,
|
||||||
117: driver.KeyLeftSuper,
|
117: driver.KeyMetaLeft,
|
||||||
118: driver.KeyRightSuper,
|
118: driver.KeyMetaRight,
|
||||||
120: driver.KeyPrintScreen,
|
120: driver.KeyPrintScreen,
|
||||||
121: driver.KeyPause,
|
121: driver.KeyPause,
|
||||||
122: driver.KeyHome,
|
122: driver.KeyHome,
|
||||||
@ -109,21 +109,21 @@ var androidKeyToDriverKey = map[int]driver.Key{
|
|||||||
141: driver.KeyF11,
|
141: driver.KeyF11,
|
||||||
142: driver.KeyF12,
|
142: driver.KeyF12,
|
||||||
143: driver.KeyNumLock,
|
143: driver.KeyNumLock,
|
||||||
144: driver.KeyKP0,
|
144: driver.KeyNumpad0,
|
||||||
145: driver.KeyKP1,
|
145: driver.KeyNumpad1,
|
||||||
146: driver.KeyKP2,
|
146: driver.KeyNumpad2,
|
||||||
147: driver.KeyKP3,
|
147: driver.KeyNumpad3,
|
||||||
148: driver.KeyKP4,
|
148: driver.KeyNumpad4,
|
||||||
149: driver.KeyKP5,
|
149: driver.KeyNumpad5,
|
||||||
150: driver.KeyKP6,
|
150: driver.KeyNumpad6,
|
||||||
151: driver.KeyKP7,
|
151: driver.KeyNumpad7,
|
||||||
152: driver.KeyKP8,
|
152: driver.KeyNumpad8,
|
||||||
153: driver.KeyKP9,
|
153: driver.KeyNumpad9,
|
||||||
154: driver.KeyKPDivide,
|
154: driver.KeyNumpadDivide,
|
||||||
155: driver.KeyKPMultiply,
|
155: driver.KeyNumpadMultiply,
|
||||||
156: driver.KeyKPSubtract,
|
156: driver.KeyNumpadSubtract,
|
||||||
157: driver.KeyKPAdd,
|
157: driver.KeyNumpadAdd,
|
||||||
158: driver.KeyKPDecimal,
|
158: driver.KeyNumpadDecimal,
|
||||||
160: driver.KeyKPEnter,
|
160: driver.KeyNumpadEnter,
|
||||||
161: driver.KeyKPEqual,
|
161: driver.KeyNumpadEqual,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user