mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
parent
33c51eeee4
commit
491b578866
16
genkeys.go
16
genkeys.go
@ -418,15 +418,25 @@ func init() {
|
||||
uiKeyNameToJSKey[string(c)] = "Key" + string(c)
|
||||
}
|
||||
// Function keys
|
||||
for i := 1; i <= 12; i++ {
|
||||
for i := 1; i <= 24; i++ {
|
||||
name := "F" + strconv.Itoa(i)
|
||||
glfwKeyNameToGLFWKey[name] = glfwKeyF1 + i - 1
|
||||
uiKeyNameToGLFWKeyName[name] = name
|
||||
// Android doesn't support F13 and more as constants of KeyEvent:
|
||||
// https://developer.android.com/reference/android/view/KeyEvent
|
||||
//
|
||||
// Note that F13 might be avilable if HID devices are available directly:
|
||||
// https://source.android.com/docs/core/interaction/input/keyboard-devices
|
||||
if i <= 12 {
|
||||
androidKeyToUIKeyName[131+i-1] = name
|
||||
// Note: iOS keys go up to F24 (with F13 being 0x68 and increasing from there),
|
||||
// but Ebitengine currently only goes to F12.
|
||||
}
|
||||
if i <= 12 {
|
||||
iosKeyToUIKeyName[0x3A+i-1] = name
|
||||
gbuildKeyToUIKeyName[key.CodeF1+key.Code(i)-1] = name
|
||||
} else {
|
||||
iosKeyToUIKeyName[0x68+i-13] = name
|
||||
gbuildKeyToUIKeyName[key.CodeF13+key.Code(i)-13] = name
|
||||
}
|
||||
uiKeyNameToJSKey[name] = name
|
||||
}
|
||||
// Numpad
|
||||
|
@ -50,7 +50,19 @@ const (
|
||||
KeyF10 = Key(299)
|
||||
KeyF11 = Key(300)
|
||||
KeyF12 = Key(301)
|
||||
KeyF13 = Key(302)
|
||||
KeyF14 = Key(303)
|
||||
KeyF15 = Key(304)
|
||||
KeyF16 = Key(305)
|
||||
KeyF17 = Key(306)
|
||||
KeyF18 = Key(307)
|
||||
KeyF19 = Key(308)
|
||||
KeyF2 = Key(291)
|
||||
KeyF20 = Key(309)
|
||||
KeyF21 = Key(310)
|
||||
KeyF22 = Key(311)
|
||||
KeyF23 = Key(312)
|
||||
KeyF24 = Key(313)
|
||||
KeyF3 = Key(292)
|
||||
KeyF4 = Key(293)
|
||||
KeyF5 = Key(294)
|
||||
|
@ -92,6 +92,18 @@ const (
|
||||
KeyF10
|
||||
KeyF11
|
||||
KeyF12
|
||||
KeyF13
|
||||
KeyF14
|
||||
KeyF15
|
||||
KeyF16
|
||||
KeyF17
|
||||
KeyF18
|
||||
KeyF19
|
||||
KeyF20
|
||||
KeyF21
|
||||
KeyF22
|
||||
KeyF23
|
||||
KeyF24
|
||||
KeyHome
|
||||
KeyInsert
|
||||
KeyMetaLeft
|
||||
@ -275,6 +287,30 @@ func (k Key) String() string {
|
||||
return "KeyF11"
|
||||
case KeyF12:
|
||||
return "KeyF12"
|
||||
case KeyF13:
|
||||
return "KeyF13"
|
||||
case KeyF14:
|
||||
return "KeyF14"
|
||||
case KeyF15:
|
||||
return "KeyF15"
|
||||
case KeyF16:
|
||||
return "KeyF16"
|
||||
case KeyF17:
|
||||
return "KeyF17"
|
||||
case KeyF18:
|
||||
return "KeyF18"
|
||||
case KeyF19:
|
||||
return "KeyF19"
|
||||
case KeyF20:
|
||||
return "KeyF20"
|
||||
case KeyF21:
|
||||
return "KeyF21"
|
||||
case KeyF22:
|
||||
return "KeyF22"
|
||||
case KeyF23:
|
||||
return "KeyF23"
|
||||
case KeyF24:
|
||||
return "KeyF24"
|
||||
case KeyHome:
|
||||
return "KeyHome"
|
||||
case KeyInsert:
|
||||
|
@ -64,7 +64,19 @@ var uiKeyToGLFWKey = map[Key]glfw.Key{
|
||||
KeyF10: glfw.KeyF10,
|
||||
KeyF11: glfw.KeyF11,
|
||||
KeyF12: glfw.KeyF12,
|
||||
KeyF13: glfw.KeyF13,
|
||||
KeyF14: glfw.KeyF14,
|
||||
KeyF15: glfw.KeyF15,
|
||||
KeyF16: glfw.KeyF16,
|
||||
KeyF17: glfw.KeyF17,
|
||||
KeyF18: glfw.KeyF18,
|
||||
KeyF19: glfw.KeyF19,
|
||||
KeyF2: glfw.KeyF2,
|
||||
KeyF20: glfw.KeyF20,
|
||||
KeyF21: glfw.KeyF21,
|
||||
KeyF22: glfw.KeyF22,
|
||||
KeyF23: glfw.KeyF23,
|
||||
KeyF24: glfw.KeyF24,
|
||||
KeyF3: glfw.KeyF3,
|
||||
KeyF4: glfw.KeyF4,
|
||||
KeyF5: glfw.KeyF5,
|
||||
|
@ -62,7 +62,19 @@ var uiKeyToJSKey = map[Key]js.Value{
|
||||
KeyF10: js.ValueOf("F10"),
|
||||
KeyF11: js.ValueOf("F11"),
|
||||
KeyF12: js.ValueOf("F12"),
|
||||
KeyF13: js.ValueOf("F13"),
|
||||
KeyF14: js.ValueOf("F14"),
|
||||
KeyF15: js.ValueOf("F15"),
|
||||
KeyF16: js.ValueOf("F16"),
|
||||
KeyF17: js.ValueOf("F17"),
|
||||
KeyF18: js.ValueOf("F18"),
|
||||
KeyF19: js.ValueOf("F19"),
|
||||
KeyF2: js.ValueOf("F2"),
|
||||
KeyF20: js.ValueOf("F20"),
|
||||
KeyF21: js.ValueOf("F21"),
|
||||
KeyF22: js.ValueOf("F22"),
|
||||
KeyF23: js.ValueOf("F23"),
|
||||
KeyF24: js.ValueOf("F24"),
|
||||
KeyF3: js.ValueOf("F3"),
|
||||
KeyF4: js.ValueOf("F4"),
|
||||
KeyF5: js.ValueOf("F5"),
|
||||
|
@ -117,6 +117,18 @@ var gbuildKeyToUIKey = map[key.Code]Key{
|
||||
key.CodeKeypad0: KeyNumpad0,
|
||||
key.CodeKeypadFullStop: KeyNumpadDecimal,
|
||||
key.CodeKeypadEqualSign: KeyNumpadEqual,
|
||||
key.CodeF13: KeyF13,
|
||||
key.CodeF14: KeyF14,
|
||||
key.CodeF15: KeyF15,
|
||||
key.CodeF16: KeyF16,
|
||||
key.CodeF17: KeyF17,
|
||||
key.CodeF18: KeyF18,
|
||||
key.CodeF19: KeyF19,
|
||||
key.CodeF20: KeyF20,
|
||||
key.CodeF21: KeyF21,
|
||||
key.CodeF22: KeyF22,
|
||||
key.CodeF23: KeyF23,
|
||||
key.CodeF24: KeyF24,
|
||||
key.CodeLeftControl: KeyControlLeft,
|
||||
key.CodeLeftShift: KeyShiftLeft,
|
||||
key.CodeLeftAlt: KeyAltLeft,
|
||||
|
84
keys.go
84
keys.go
@ -99,6 +99,18 @@ const (
|
||||
KeyF10 Key = Key(ui.KeyF10)
|
||||
KeyF11 Key = Key(ui.KeyF11)
|
||||
KeyF12 Key = Key(ui.KeyF12)
|
||||
KeyF13 Key = Key(ui.KeyF13)
|
||||
KeyF14 Key = Key(ui.KeyF14)
|
||||
KeyF15 Key = Key(ui.KeyF15)
|
||||
KeyF16 Key = Key(ui.KeyF16)
|
||||
KeyF17 Key = Key(ui.KeyF17)
|
||||
KeyF18 Key = Key(ui.KeyF18)
|
||||
KeyF19 Key = Key(ui.KeyF19)
|
||||
KeyF20 Key = Key(ui.KeyF20)
|
||||
KeyF21 Key = Key(ui.KeyF21)
|
||||
KeyF22 Key = Key(ui.KeyF22)
|
||||
KeyF23 Key = Key(ui.KeyF23)
|
||||
KeyF24 Key = Key(ui.KeyF24)
|
||||
KeyHome Key = Key(ui.KeyHome)
|
||||
KeyInsert Key = Key(ui.KeyInsert)
|
||||
KeyMetaLeft Key = Key(ui.KeyMetaLeft)
|
||||
@ -325,6 +337,30 @@ func (k Key) isValid() bool {
|
||||
return true
|
||||
case KeyF12:
|
||||
return true
|
||||
case KeyF13:
|
||||
return true
|
||||
case KeyF14:
|
||||
return true
|
||||
case KeyF15:
|
||||
return true
|
||||
case KeyF16:
|
||||
return true
|
||||
case KeyF17:
|
||||
return true
|
||||
case KeyF18:
|
||||
return true
|
||||
case KeyF19:
|
||||
return true
|
||||
case KeyF20:
|
||||
return true
|
||||
case KeyF21:
|
||||
return true
|
||||
case KeyF22:
|
||||
return true
|
||||
case KeyF23:
|
||||
return true
|
||||
case KeyF24:
|
||||
return true
|
||||
case KeyHome:
|
||||
return true
|
||||
case KeyInsert:
|
||||
@ -554,6 +590,30 @@ func (k Key) String() string {
|
||||
return "F11"
|
||||
case KeyF12:
|
||||
return "F12"
|
||||
case KeyF13:
|
||||
return "F13"
|
||||
case KeyF14:
|
||||
return "F14"
|
||||
case KeyF15:
|
||||
return "F15"
|
||||
case KeyF16:
|
||||
return "F16"
|
||||
case KeyF17:
|
||||
return "F17"
|
||||
case KeyF18:
|
||||
return "F18"
|
||||
case KeyF19:
|
||||
return "F19"
|
||||
case KeyF20:
|
||||
return "F20"
|
||||
case KeyF21:
|
||||
return "F21"
|
||||
case KeyF22:
|
||||
return "F22"
|
||||
case KeyF23:
|
||||
return "F23"
|
||||
case KeyF24:
|
||||
return "F24"
|
||||
case KeyHome:
|
||||
return "Home"
|
||||
case KeyInsert:
|
||||
@ -802,6 +862,30 @@ func keyNameToKeyCode(name string) (Key, bool) {
|
||||
return KeyF11, true
|
||||
case "f12":
|
||||
return KeyF12, true
|
||||
case "f13":
|
||||
return KeyF13, true
|
||||
case "f14":
|
||||
return KeyF14, true
|
||||
case "f15":
|
||||
return KeyF15, true
|
||||
case "f16":
|
||||
return KeyF16, true
|
||||
case "f17":
|
||||
return KeyF17, true
|
||||
case "f18":
|
||||
return KeyF18, true
|
||||
case "f19":
|
||||
return KeyF19, true
|
||||
case "f20":
|
||||
return KeyF20, true
|
||||
case "f21":
|
||||
return KeyF21, true
|
||||
case "f22":
|
||||
return KeyF22, true
|
||||
case "f23":
|
||||
return KeyF23, true
|
||||
case "f24":
|
||||
return KeyF24, true
|
||||
case "graveaccent":
|
||||
return KeyGraveAccent, true
|
||||
case "home":
|
||||
|
@ -119,6 +119,18 @@ var iosKeyToUIKey = map[int]ui.Key{
|
||||
99: ui.KeyNumpadDecimal,
|
||||
100: ui.KeyBackslash,
|
||||
103: ui.KeyNumpadEqual,
|
||||
104: ui.KeyF13,
|
||||
105: ui.KeyF14,
|
||||
106: ui.KeyF15,
|
||||
107: ui.KeyF16,
|
||||
108: ui.KeyF17,
|
||||
109: ui.KeyF18,
|
||||
110: ui.KeyF19,
|
||||
111: ui.KeyF20,
|
||||
112: ui.KeyF21,
|
||||
113: ui.KeyF22,
|
||||
114: ui.KeyF23,
|
||||
115: ui.KeyF24,
|
||||
118: ui.KeyContextMenu,
|
||||
130: ui.KeyCapsLock,
|
||||
131: ui.KeyNumLock,
|
||||
|
Loading…
Reference in New Issue
Block a user