input: Move Key to driver package

This commit is contained in:
Hajime Hoshi 2019-03-30 23:28:07 +09:00
parent e5b1aa8742
commit 7dca1889a1
7 changed files with 422 additions and 420 deletions

View File

@ -239,7 +239,7 @@ package ebiten
import (
"strings"
"github.com/hajimehoshi/ebiten/internal/input"
"github.com/hajimehoshi/ebiten/internal/driver"
)
// A Key represents a keyboard key.
@ -249,7 +249,7 @@ type Key int
// Keys.
const (
{{range $index, $name := .KeyNames}}Key{{$name}} Key = Key(input.Key{{$name}})
{{range $index, $name := .KeyNames}}Key{{$name}} Key = Key(driver.Key{{$name}})
{{end}} KeyMax Key = Key{{.LastKeyName}}
)
@ -273,11 +273,11 @@ func keyNameToKey(name string) (Key, bool) {
}
`
const inputKeysTmpl = `{{.License}}
const driverKeysTmpl = `{{.License}}
{{.DoNotEdit}}
package input
package driver
type Key int
@ -296,18 +296,19 @@ const inputKeysGlfwTmpl = `{{.License}}
package input
import (
"github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/glfw"
)
var glfwKeyCodeToKey = map[glfw.Key]Key{
{{range $index, $name := .KeyNamesWithoutMods}}glfw.Key{{$name}}: Key{{$name}},
var glfwKeyCodeToKey = map[glfw.Key]driver.Key{
{{range $index, $name := .KeyNamesWithoutMods}}glfw.Key{{$name}}: driver.Key{{$name}},
{{end}}
glfw.KeyLeftAlt: KeyAlt,
glfw.KeyRightAlt: KeyAlt,
glfw.KeyLeftControl: KeyControl,
glfw.KeyRightControl: KeyControl,
glfw.KeyLeftShift: KeyShift,
glfw.KeyRightShift: KeyShift,
glfw.KeyLeftAlt: driver.KeyAlt,
glfw.KeyRightAlt: driver.KeyAlt,
glfw.KeyLeftControl: driver.KeyControl,
glfw.KeyRightControl: driver.KeyControl,
glfw.KeyLeftShift: driver.KeyShift,
glfw.KeyRightShift: driver.KeyShift,
}
`
@ -320,14 +321,14 @@ const inputKeysJSTmpl = `{{.License}}
package input
var keyToCodes = map[Key][]string{
{{range $name, $codes := .NameToJSKeyCodes}}Key{{$name}}: []string{
{{range $name, $codes := .NameToJSKeyCodes}}driver.Key{{$name}}: []string{
{{range $code := $codes}}"{{$code}}",{{end}}
},
{{end}}
}
var keyCodeToKeyEdge = map[int]Key{
{{range $code, $name := .KeyCodeToNameEdge}}{{$code}}: Key{{$name}},
{{range $code, $name := .KeyCodeToNameEdge}}{{$code}}: driver.Key{{$name}},
{{end}}
}
`
@ -468,7 +469,7 @@ func main() {
for path, tmpl := range map[string]string{
"keys.go": ebitenKeysTmpl,
"internal/input/keys.go": inputKeysTmpl,
"internal/driver/keys.go": driverKeysTmpl,
"internal/input/keys_glfw.go": inputKeysGlfwTmpl,
"internal/input/keys_js.go": inputKeysJSTmpl,
"internal/glfw/keys.go": glfwKeysTmpl,

View File

@ -43,7 +43,7 @@ func InputChars() []rune {
//
// IsKeyPressed is concurrent-safe.
func IsKeyPressed(key Key) bool {
return input.Get().IsKeyPressed(input.Key(key))
return input.Get().IsKeyPressed(driver.Key(key))
}
// CursorPosition returns a position of a mouse cursor.

View File

@ -14,7 +14,7 @@
// Code generated by genkeys.go using 'go generate'. DO NOT EDIT.
package input
package driver
type Key int

View File

@ -59,7 +59,7 @@ func (i *Input) ResetScrollValues() {
i.scrollX, i.scrollY = 0, 0
}
func (i *Input) IsKeyPressed(key Key) bool {
func (i *Input) IsKeyPressed(key driver.Key) bool {
i.m.RLock()
defer i.m.RUnlock()
if i.keyPressed == nil {

View File

@ -22,112 +22,113 @@
package input
import (
"github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/glfw"
)
var glfwKeyCodeToKey = map[glfw.Key]Key{
glfw.Key0: Key0,
glfw.Key1: Key1,
glfw.Key2: Key2,
glfw.Key3: Key3,
glfw.Key4: Key4,
glfw.Key5: Key5,
glfw.Key6: Key6,
glfw.Key7: Key7,
glfw.Key8: Key8,
glfw.Key9: Key9,
glfw.KeyA: KeyA,
glfw.KeyB: KeyB,
glfw.KeyC: KeyC,
glfw.KeyD: KeyD,
glfw.KeyE: KeyE,
glfw.KeyF: KeyF,
glfw.KeyG: KeyG,
glfw.KeyH: KeyH,
glfw.KeyI: KeyI,
glfw.KeyJ: KeyJ,
glfw.KeyK: KeyK,
glfw.KeyL: KeyL,
glfw.KeyM: KeyM,
glfw.KeyN: KeyN,
glfw.KeyO: KeyO,
glfw.KeyP: KeyP,
glfw.KeyQ: KeyQ,
glfw.KeyR: KeyR,
glfw.KeyS: KeyS,
glfw.KeyT: KeyT,
glfw.KeyU: KeyU,
glfw.KeyV: KeyV,
glfw.KeyW: KeyW,
glfw.KeyX: KeyX,
glfw.KeyY: KeyY,
glfw.KeyZ: KeyZ,
glfw.KeyApostrophe: KeyApostrophe,
glfw.KeyBackslash: KeyBackslash,
glfw.KeyBackspace: KeyBackspace,
glfw.KeyCapsLock: KeyCapsLock,
glfw.KeyComma: KeyComma,
glfw.KeyDelete: KeyDelete,
glfw.KeyDown: KeyDown,
glfw.KeyEnd: KeyEnd,
glfw.KeyEnter: KeyEnter,
glfw.KeyEqual: KeyEqual,
glfw.KeyEscape: KeyEscape,
glfw.KeyF1: KeyF1,
glfw.KeyF2: KeyF2,
glfw.KeyF3: KeyF3,
glfw.KeyF4: KeyF4,
glfw.KeyF5: KeyF5,
glfw.KeyF6: KeyF6,
glfw.KeyF7: KeyF7,
glfw.KeyF8: KeyF8,
glfw.KeyF9: KeyF9,
glfw.KeyF10: KeyF10,
glfw.KeyF11: KeyF11,
glfw.KeyF12: KeyF12,
glfw.KeyGraveAccent: KeyGraveAccent,
glfw.KeyHome: KeyHome,
glfw.KeyInsert: KeyInsert,
glfw.KeyKP0: KeyKP0,
glfw.KeyKP1: KeyKP1,
glfw.KeyKP2: KeyKP2,
glfw.KeyKP3: KeyKP3,
glfw.KeyKP4: KeyKP4,
glfw.KeyKP5: KeyKP5,
glfw.KeyKP6: KeyKP6,
glfw.KeyKP7: KeyKP7,
glfw.KeyKP8: KeyKP8,
glfw.KeyKP9: KeyKP9,
glfw.KeyKPAdd: KeyKPAdd,
glfw.KeyKPDecimal: KeyKPDecimal,
glfw.KeyKPDivide: KeyKPDivide,
glfw.KeyKPEnter: KeyKPEnter,
glfw.KeyKPEqual: KeyKPEqual,
glfw.KeyKPMultiply: KeyKPMultiply,
glfw.KeyKPSubtract: KeyKPSubtract,
glfw.KeyLeft: KeyLeft,
glfw.KeyLeftBracket: KeyLeftBracket,
glfw.KeyMenu: KeyMenu,
glfw.KeyMinus: KeyMinus,
glfw.KeyNumLock: KeyNumLock,
glfw.KeyPageDown: KeyPageDown,
glfw.KeyPageUp: KeyPageUp,
glfw.KeyPause: KeyPause,
glfw.KeyPeriod: KeyPeriod,
glfw.KeyPrintScreen: KeyPrintScreen,
glfw.KeyRight: KeyRight,
glfw.KeyRightBracket: KeyRightBracket,
glfw.KeyScrollLock: KeyScrollLock,
glfw.KeySemicolon: KeySemicolon,
glfw.KeySlash: KeySlash,
glfw.KeySpace: KeySpace,
glfw.KeyTab: KeyTab,
glfw.KeyUp: KeyUp,
var glfwKeyCodeToKey = 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.KeyB: driver.KeyB,
glfw.KeyC: driver.KeyC,
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.KeyBackspace: driver.KeyBackspace,
glfw.KeyCapsLock: driver.KeyCapsLock,
glfw.KeyComma: driver.KeyComma,
glfw.KeyDelete: driver.KeyDelete,
glfw.KeyDown: driver.KeyDown,
glfw.KeyEnd: driver.KeyEnd,
glfw.KeyEnter: driver.KeyEnter,
glfw.KeyEqual: driver.KeyEqual,
glfw.KeyEscape: driver.KeyEscape,
glfw.KeyF1: driver.KeyF1,
glfw.KeyF2: driver.KeyF2,
glfw.KeyF3: driver.KeyF3,
glfw.KeyF4: driver.KeyF4,
glfw.KeyF5: driver.KeyF5,
glfw.KeyF6: driver.KeyF6,
glfw.KeyF7: driver.KeyF7,
glfw.KeyF8: driver.KeyF8,
glfw.KeyF9: driver.KeyF9,
glfw.KeyF10: driver.KeyF10,
glfw.KeyF11: driver.KeyF11,
glfw.KeyF12: driver.KeyF12,
glfw.KeyGraveAccent: driver.KeyGraveAccent,
glfw.KeyHome: driver.KeyHome,
glfw.KeyInsert: driver.KeyInsert,
glfw.KeyKP0: driver.KeyKP0,
glfw.KeyKP1: driver.KeyKP1,
glfw.KeyKP2: driver.KeyKP2,
glfw.KeyKP3: driver.KeyKP3,
glfw.KeyKP4: driver.KeyKP4,
glfw.KeyKP5: driver.KeyKP5,
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.KeyLeftBracket: driver.KeyLeftBracket,
glfw.KeyMenu: driver.KeyMenu,
glfw.KeyMinus: driver.KeyMinus,
glfw.KeyNumLock: driver.KeyNumLock,
glfw.KeyPageDown: driver.KeyPageDown,
glfw.KeyPageUp: driver.KeyPageUp,
glfw.KeyPause: driver.KeyPause,
glfw.KeyPeriod: driver.KeyPeriod,
glfw.KeyPrintScreen: driver.KeyPrintScreen,
glfw.KeyRight: driver.KeyRight,
glfw.KeyRightBracket: driver.KeyRightBracket,
glfw.KeyScrollLock: driver.KeyScrollLock,
glfw.KeySemicolon: driver.KeySemicolon,
glfw.KeySlash: driver.KeySlash,
glfw.KeySpace: driver.KeySpace,
glfw.KeyTab: driver.KeyTab,
glfw.KeyUp: driver.KeyUp,
glfw.KeyLeftAlt: KeyAlt,
glfw.KeyRightAlt: KeyAlt,
glfw.KeyLeftControl: KeyControl,
glfw.KeyRightControl: KeyControl,
glfw.KeyLeftShift: KeyShift,
glfw.KeyRightShift: KeyShift,
glfw.KeyLeftAlt: driver.KeyAlt,
glfw.KeyRightAlt: driver.KeyAlt,
glfw.KeyLeftControl: driver.KeyControl,
glfw.KeyRightControl: driver.KeyControl,
glfw.KeyLeftShift: driver.KeyShift,
glfw.KeyRightShift: driver.KeyShift,
}

View File

@ -19,404 +19,404 @@
package input
var keyToCodes = map[Key][]string{
Key0: {
driver.Key0: {
"Digit0",
},
Key1: {
driver.Key1: {
"Digit1",
},
Key2: {
driver.Key2: {
"Digit2",
},
Key3: {
driver.Key3: {
"Digit3",
},
Key4: {
driver.Key4: {
"Digit4",
},
Key5: {
driver.Key5: {
"Digit5",
},
Key6: {
driver.Key6: {
"Digit6",
},
Key7: {
driver.Key7: {
"Digit7",
},
Key8: {
driver.Key8: {
"Digit8",
},
Key9: {
driver.Key9: {
"Digit9",
},
KeyA: {
driver.KeyA: {
"KeyA",
},
KeyAlt: {
driver.KeyAlt: {
"AltLeft", "AltRight",
},
KeyApostrophe: {
driver.KeyApostrophe: {
"Quote",
},
KeyB: {
driver.KeyB: {
"KeyB",
},
KeyBackslash: {
driver.KeyBackslash: {
"Backslash",
},
KeyBackspace: {
driver.KeyBackspace: {
"Backspace",
},
KeyC: {
driver.KeyC: {
"KeyC",
},
KeyCapsLock: {
driver.KeyCapsLock: {
"CapsLock",
},
KeyComma: {
driver.KeyComma: {
"Comma",
},
KeyControl: {
driver.KeyControl: {
"ControlLeft", "ControlRight",
},
KeyD: {
driver.KeyD: {
"KeyD",
},
KeyDelete: {
driver.KeyDelete: {
"Delete",
},
KeyDown: {
driver.KeyDown: {
"ArrowDown",
},
KeyE: {
driver.KeyE: {
"KeyE",
},
KeyEnd: {
driver.KeyEnd: {
"End",
},
KeyEnter: {
driver.KeyEnter: {
"Enter",
},
KeyEqual: {
driver.KeyEqual: {
"Equal",
},
KeyEscape: {
driver.KeyEscape: {
"Escape",
},
KeyF: {
driver.KeyF: {
"KeyF",
},
KeyF1: {
driver.KeyF1: {
"F1",
},
KeyF10: {
driver.KeyF10: {
"F10",
},
KeyF11: {
driver.KeyF11: {
"F11",
},
KeyF12: {
driver.KeyF12: {
"F12",
},
KeyF2: {
driver.KeyF2: {
"F2",
},
KeyF3: {
driver.KeyF3: {
"F3",
},
KeyF4: {
driver.KeyF4: {
"F4",
},
KeyF5: {
driver.KeyF5: {
"F5",
},
KeyF6: {
driver.KeyF6: {
"F6",
},
KeyF7: {
driver.KeyF7: {
"F7",
},
KeyF8: {
driver.KeyF8: {
"F8",
},
KeyF9: {
driver.KeyF9: {
"F9",
},
KeyG: {
driver.KeyG: {
"KeyG",
},
KeyGraveAccent: {
driver.KeyGraveAccent: {
"Backquote",
},
KeyH: {
driver.KeyH: {
"KeyH",
},
KeyHome: {
driver.KeyHome: {
"Home",
},
KeyI: {
driver.KeyI: {
"KeyI",
},
KeyInsert: {
driver.KeyInsert: {
"Insert",
},
KeyJ: {
driver.KeyJ: {
"KeyJ",
},
KeyK: {
driver.KeyK: {
"KeyK",
},
KeyKP0: {
driver.KeyKP0: {
"Numpad0",
},
KeyKP1: {
driver.KeyKP1: {
"Numpad1",
},
KeyKP2: {
driver.KeyKP2: {
"Numpad2",
},
KeyKP3: {
driver.KeyKP3: {
"Numpad3",
},
KeyKP4: {
driver.KeyKP4: {
"Numpad4",
},
KeyKP5: {
driver.KeyKP5: {
"Numpad5",
},
KeyKP6: {
driver.KeyKP6: {
"Numpad6",
},
KeyKP7: {
driver.KeyKP7: {
"Numpad7",
},
KeyKP8: {
driver.KeyKP8: {
"Numpad8",
},
KeyKP9: {
driver.KeyKP9: {
"Numpad9",
},
KeyKPAdd: {
driver.KeyKPAdd: {
"NumpadAdd",
},
KeyKPDecimal: {
driver.KeyKPDecimal: {
"NumpadDecimal",
},
KeyKPDivide: {
driver.KeyKPDivide: {
"NumpadDivide",
},
KeyKPEnter: {
driver.KeyKPEnter: {
"NumpadEnter",
},
KeyKPEqual: {
driver.KeyKPEqual: {
"NumpadEqual",
},
KeyKPMultiply: {
driver.KeyKPMultiply: {
"NumpadMultiply",
},
KeyKPSubtract: {
driver.KeyKPSubtract: {
"NumpadSubtract",
},
KeyL: {
driver.KeyL: {
"KeyL",
},
KeyLeft: {
driver.KeyLeft: {
"ArrowLeft",
},
KeyLeftBracket: {
driver.KeyLeftBracket: {
"BracketLeft",
},
KeyM: {
driver.KeyM: {
"KeyM",
},
KeyMenu: {
driver.KeyMenu: {
"ContextMenu",
},
KeyMinus: {
driver.KeyMinus: {
"Minus",
},
KeyN: {
driver.KeyN: {
"KeyN",
},
KeyNumLock: {
driver.KeyNumLock: {
"NumLock",
},
KeyO: {
driver.KeyO: {
"KeyO",
},
KeyP: {
driver.KeyP: {
"KeyP",
},
KeyPageDown: {
driver.KeyPageDown: {
"PageDown",
},
KeyPageUp: {
driver.KeyPageUp: {
"PageUp",
},
KeyPause: {
driver.KeyPause: {
"Pause",
},
KeyPeriod: {
driver.KeyPeriod: {
"Period",
},
KeyPrintScreen: {
driver.KeyPrintScreen: {
"PrintScreen",
},
KeyQ: {
driver.KeyQ: {
"KeyQ",
},
KeyR: {
driver.KeyR: {
"KeyR",
},
KeyRight: {
driver.KeyRight: {
"ArrowRight",
},
KeyRightBracket: {
driver.KeyRightBracket: {
"BracketRight",
},
KeyS: {
driver.KeyS: {
"KeyS",
},
KeyScrollLock: {
driver.KeyScrollLock: {
"ScrollLock",
},
KeySemicolon: {
driver.KeySemicolon: {
"Semicolon",
},
KeyShift: {
driver.KeyShift: {
"ShiftLeft", "ShiftRight",
},
KeySlash: {
driver.KeySlash: {
"Slash",
},
KeySpace: {
driver.KeySpace: {
"Space",
},
KeyT: {
driver.KeyT: {
"KeyT",
},
KeyTab: {
driver.KeyTab: {
"Tab",
},
KeyU: {
driver.KeyU: {
"KeyU",
},
KeyUp: {
driver.KeyUp: {
"ArrowUp",
},
KeyV: {
driver.KeyV: {
"KeyV",
},
KeyW: {
driver.KeyW: {
"KeyW",
},
KeyX: {
driver.KeyX: {
"KeyX",
},
KeyY: {
driver.KeyY: {
"KeyY",
},
KeyZ: {
driver.KeyZ: {
"KeyZ",
},
}
var keyCodeToKeyEdge = map[int]Key{
8: KeyBackspace,
9: KeyTab,
13: KeyEnter,
16: KeyShift,
17: KeyControl,
18: KeyAlt,
19: KeyPause,
20: KeyCapsLock,
27: KeyEscape,
32: KeySpace,
33: KeyPageUp,
34: KeyPageDown,
35: KeyEnd,
36: KeyHome,
37: KeyLeft,
38: KeyUp,
39: KeyRight,
40: KeyDown,
45: KeyInsert,
46: KeyDelete,
48: Key0,
49: Key1,
50: Key2,
51: Key3,
52: Key4,
53: Key5,
54: Key6,
55: Key7,
56: Key8,
57: Key9,
65: KeyA,
66: KeyB,
67: KeyC,
68: KeyD,
69: KeyE,
70: KeyF,
71: KeyG,
72: KeyH,
73: KeyI,
74: KeyJ,
75: KeyK,
76: KeyL,
77: KeyM,
78: KeyN,
79: KeyO,
80: KeyP,
81: KeyQ,
82: KeyR,
83: KeyS,
84: KeyT,
85: KeyU,
86: KeyV,
87: KeyW,
88: KeyX,
89: KeyY,
90: KeyZ,
93: KeyMenu,
96: KeyKP0,
97: KeyKP1,
98: KeyKP2,
99: KeyKP3,
100: KeyKP4,
101: KeyKP5,
102: KeyKP6,
103: KeyKP7,
104: KeyKP8,
105: KeyKP9,
106: KeyKPMultiply,
107: KeyKPAdd,
109: KeyKPSubtract,
110: KeyKPDecimal,
111: KeyKPDivide,
112: KeyF1,
113: KeyF2,
114: KeyF3,
115: KeyF4,
116: KeyF5,
117: KeyF6,
118: KeyF7,
119: KeyF8,
120: KeyF9,
121: KeyF10,
122: KeyF11,
123: KeyF12,
144: KeyNumLock,
145: KeyScrollLock,
186: KeySemicolon,
187: KeyEqual,
188: KeyComma,
189: KeyMinus,
190: KeyPeriod,
191: KeySlash,
192: KeyGraveAccent,
219: KeyLeftBracket,
220: KeyBackslash,
221: KeyRightBracket,
222: KeyApostrophe,
8: driver.KeyBackspace,
9: driver.KeyTab,
13: driver.KeyEnter,
16: driver.KeyShift,
17: driver.KeyControl,
18: driver.KeyAlt,
19: driver.KeyPause,
20: driver.KeyCapsLock,
27: driver.KeyEscape,
32: driver.KeySpace,
33: driver.KeyPageUp,
34: driver.KeyPageDown,
35: driver.KeyEnd,
36: driver.KeyHome,
37: driver.KeyLeft,
38: driver.KeyUp,
39: driver.KeyRight,
40: driver.KeyDown,
45: driver.KeyInsert,
46: driver.KeyDelete,
48: driver.Key0,
49: driver.Key1,
50: driver.Key2,
51: driver.Key3,
52: driver.Key4,
53: driver.Key5,
54: driver.Key6,
55: driver.Key7,
56: driver.Key8,
57: driver.Key9,
65: driver.KeyA,
66: driver.KeyB,
67: driver.KeyC,
68: driver.KeyD,
69: driver.KeyE,
70: driver.KeyF,
71: driver.KeyG,
72: driver.KeyH,
73: driver.KeyI,
74: driver.KeyJ,
75: driver.KeyK,
76: driver.KeyL,
77: driver.KeyM,
78: driver.KeyN,
79: driver.KeyO,
80: driver.KeyP,
81: driver.KeyQ,
82: driver.KeyR,
83: driver.KeyS,
84: driver.KeyT,
85: driver.KeyU,
86: driver.KeyV,
87: driver.KeyW,
88: driver.KeyX,
89: driver.KeyY,
90: driver.KeyZ,
93: driver.KeyMenu,
96: driver.KeyKP0,
97: driver.KeyKP1,
98: driver.KeyKP2,
99: driver.KeyKP3,
100: driver.KeyKP4,
101: driver.KeyKP5,
102: driver.KeyKP6,
103: driver.KeyKP7,
104: driver.KeyKP8,
105: driver.KeyKP9,
106: driver.KeyKPMultiply,
107: driver.KeyKPAdd,
109: driver.KeyKPSubtract,
110: driver.KeyKPDecimal,
111: driver.KeyKPDivide,
112: driver.KeyF1,
113: driver.KeyF2,
114: driver.KeyF3,
115: driver.KeyF4,
116: driver.KeyF5,
117: driver.KeyF6,
118: driver.KeyF7,
119: driver.KeyF8,
120: driver.KeyF9,
121: driver.KeyF10,
122: driver.KeyF11,
123: driver.KeyF12,
144: driver.KeyNumLock,
145: driver.KeyScrollLock,
186: driver.KeySemicolon,
187: driver.KeyEqual,
188: driver.KeyComma,
189: driver.KeyMinus,
190: driver.KeyPeriod,
191: driver.KeySlash,
192: driver.KeyGraveAccent,
219: driver.KeyLeftBracket,
220: driver.KeyBackslash,
221: driver.KeyRightBracket,
222: driver.KeyApostrophe,
}

202
keys.go
View File

@ -19,7 +19,7 @@ package ebiten
import (
"strings"
"github.com/hajimehoshi/ebiten/internal/input"
"github.com/hajimehoshi/ebiten/internal/driver"
)
// A Key represents a keyboard key.
@ -29,106 +29,106 @@ type Key int
// Keys.
const (
Key0 Key = Key(input.Key0)
Key1 Key = Key(input.Key1)
Key2 Key = Key(input.Key2)
Key3 Key = Key(input.Key3)
Key4 Key = Key(input.Key4)
Key5 Key = Key(input.Key5)
Key6 Key = Key(input.Key6)
Key7 Key = Key(input.Key7)
Key8 Key = Key(input.Key8)
Key9 Key = Key(input.Key9)
KeyA Key = Key(input.KeyA)
KeyB Key = Key(input.KeyB)
KeyC Key = Key(input.KeyC)
KeyD Key = Key(input.KeyD)
KeyE Key = Key(input.KeyE)
KeyF Key = Key(input.KeyF)
KeyG Key = Key(input.KeyG)
KeyH Key = Key(input.KeyH)
KeyI Key = Key(input.KeyI)
KeyJ Key = Key(input.KeyJ)
KeyK Key = Key(input.KeyK)
KeyL Key = Key(input.KeyL)
KeyM Key = Key(input.KeyM)
KeyN Key = Key(input.KeyN)
KeyO Key = Key(input.KeyO)
KeyP Key = Key(input.KeyP)
KeyQ Key = Key(input.KeyQ)
KeyR Key = Key(input.KeyR)
KeyS Key = Key(input.KeyS)
KeyT Key = Key(input.KeyT)
KeyU Key = Key(input.KeyU)
KeyV Key = Key(input.KeyV)
KeyW Key = Key(input.KeyW)
KeyX Key = Key(input.KeyX)
KeyY Key = Key(input.KeyY)
KeyZ Key = Key(input.KeyZ)
KeyAlt Key = Key(input.KeyAlt)
KeyApostrophe Key = Key(input.KeyApostrophe)
KeyBackslash Key = Key(input.KeyBackslash)
KeyBackspace Key = Key(input.KeyBackspace)
KeyCapsLock Key = Key(input.KeyCapsLock)
KeyComma Key = Key(input.KeyComma)
KeyControl Key = Key(input.KeyControl)
KeyDelete Key = Key(input.KeyDelete)
KeyDown Key = Key(input.KeyDown)
KeyEnd Key = Key(input.KeyEnd)
KeyEnter Key = Key(input.KeyEnter)
KeyEqual Key = Key(input.KeyEqual)
KeyEscape Key = Key(input.KeyEscape)
KeyF1 Key = Key(input.KeyF1)
KeyF2 Key = Key(input.KeyF2)
KeyF3 Key = Key(input.KeyF3)
KeyF4 Key = Key(input.KeyF4)
KeyF5 Key = Key(input.KeyF5)
KeyF6 Key = Key(input.KeyF6)
KeyF7 Key = Key(input.KeyF7)
KeyF8 Key = Key(input.KeyF8)
KeyF9 Key = Key(input.KeyF9)
KeyF10 Key = Key(input.KeyF10)
KeyF11 Key = Key(input.KeyF11)
KeyF12 Key = Key(input.KeyF12)
KeyGraveAccent Key = Key(input.KeyGraveAccent)
KeyHome Key = Key(input.KeyHome)
KeyInsert Key = Key(input.KeyInsert)
KeyKP0 Key = Key(input.KeyKP0)
KeyKP1 Key = Key(input.KeyKP1)
KeyKP2 Key = Key(input.KeyKP2)
KeyKP3 Key = Key(input.KeyKP3)
KeyKP4 Key = Key(input.KeyKP4)
KeyKP5 Key = Key(input.KeyKP5)
KeyKP6 Key = Key(input.KeyKP6)
KeyKP7 Key = Key(input.KeyKP7)
KeyKP8 Key = Key(input.KeyKP8)
KeyKP9 Key = Key(input.KeyKP9)
KeyKPAdd Key = Key(input.KeyKPAdd)
KeyKPDecimal Key = Key(input.KeyKPDecimal)
KeyKPDivide Key = Key(input.KeyKPDivide)
KeyKPEnter Key = Key(input.KeyKPEnter)
KeyKPEqual Key = Key(input.KeyKPEqual)
KeyKPMultiply Key = Key(input.KeyKPMultiply)
KeyKPSubtract Key = Key(input.KeyKPSubtract)
KeyLeft Key = Key(input.KeyLeft)
KeyLeftBracket Key = Key(input.KeyLeftBracket)
KeyMenu Key = Key(input.KeyMenu)
KeyMinus Key = Key(input.KeyMinus)
KeyNumLock Key = Key(input.KeyNumLock)
KeyPageDown Key = Key(input.KeyPageDown)
KeyPageUp Key = Key(input.KeyPageUp)
KeyPause Key = Key(input.KeyPause)
KeyPeriod Key = Key(input.KeyPeriod)
KeyPrintScreen Key = Key(input.KeyPrintScreen)
KeyRight Key = Key(input.KeyRight)
KeyRightBracket Key = Key(input.KeyRightBracket)
KeyScrollLock Key = Key(input.KeyScrollLock)
KeySemicolon Key = Key(input.KeySemicolon)
KeyShift Key = Key(input.KeyShift)
KeySlash Key = Key(input.KeySlash)
KeySpace Key = Key(input.KeySpace)
KeyTab Key = Key(input.KeyTab)
KeyUp Key = Key(input.KeyUp)
Key0 Key = Key(driver.Key0)
Key1 Key = Key(driver.Key1)
Key2 Key = Key(driver.Key2)
Key3 Key = Key(driver.Key3)
Key4 Key = Key(driver.Key4)
Key5 Key = Key(driver.Key5)
Key6 Key = Key(driver.Key6)
Key7 Key = Key(driver.Key7)
Key8 Key = Key(driver.Key8)
Key9 Key = Key(driver.Key9)
KeyA Key = Key(driver.KeyA)
KeyB Key = Key(driver.KeyB)
KeyC Key = Key(driver.KeyC)
KeyD Key = Key(driver.KeyD)
KeyE Key = Key(driver.KeyE)
KeyF Key = Key(driver.KeyF)
KeyG Key = Key(driver.KeyG)
KeyH Key = Key(driver.KeyH)
KeyI Key = Key(driver.KeyI)
KeyJ Key = Key(driver.KeyJ)
KeyK Key = Key(driver.KeyK)
KeyL Key = Key(driver.KeyL)
KeyM Key = Key(driver.KeyM)
KeyN Key = Key(driver.KeyN)
KeyO Key = Key(driver.KeyO)
KeyP Key = Key(driver.KeyP)
KeyQ Key = Key(driver.KeyQ)
KeyR Key = Key(driver.KeyR)
KeyS Key = Key(driver.KeyS)
KeyT Key = Key(driver.KeyT)
KeyU Key = Key(driver.KeyU)
KeyV Key = Key(driver.KeyV)
KeyW Key = Key(driver.KeyW)
KeyX Key = Key(driver.KeyX)
KeyY Key = Key(driver.KeyY)
KeyZ Key = Key(driver.KeyZ)
KeyAlt Key = Key(driver.KeyAlt)
KeyApostrophe Key = Key(driver.KeyApostrophe)
KeyBackslash Key = Key(driver.KeyBackslash)
KeyBackspace Key = Key(driver.KeyBackspace)
KeyCapsLock Key = Key(driver.KeyCapsLock)
KeyComma Key = Key(driver.KeyComma)
KeyControl Key = Key(driver.KeyControl)
KeyDelete Key = Key(driver.KeyDelete)
KeyDown Key = Key(driver.KeyDown)
KeyEnd Key = Key(driver.KeyEnd)
KeyEnter Key = Key(driver.KeyEnter)
KeyEqual Key = Key(driver.KeyEqual)
KeyEscape Key = Key(driver.KeyEscape)
KeyF1 Key = Key(driver.KeyF1)
KeyF2 Key = Key(driver.KeyF2)
KeyF3 Key = Key(driver.KeyF3)
KeyF4 Key = Key(driver.KeyF4)
KeyF5 Key = Key(driver.KeyF5)
KeyF6 Key = Key(driver.KeyF6)
KeyF7 Key = Key(driver.KeyF7)
KeyF8 Key = Key(driver.KeyF8)
KeyF9 Key = Key(driver.KeyF9)
KeyF10 Key = Key(driver.KeyF10)
KeyF11 Key = Key(driver.KeyF11)
KeyF12 Key = Key(driver.KeyF12)
KeyGraveAccent Key = Key(driver.KeyGraveAccent)
KeyHome Key = Key(driver.KeyHome)
KeyInsert Key = Key(driver.KeyInsert)
KeyKP0 Key = Key(driver.KeyKP0)
KeyKP1 Key = Key(driver.KeyKP1)
KeyKP2 Key = Key(driver.KeyKP2)
KeyKP3 Key = Key(driver.KeyKP3)
KeyKP4 Key = Key(driver.KeyKP4)
KeyKP5 Key = Key(driver.KeyKP5)
KeyKP6 Key = Key(driver.KeyKP6)
KeyKP7 Key = Key(driver.KeyKP7)
KeyKP8 Key = Key(driver.KeyKP8)
KeyKP9 Key = Key(driver.KeyKP9)
KeyKPAdd Key = Key(driver.KeyKPAdd)
KeyKPDecimal Key = Key(driver.KeyKPDecimal)
KeyKPDivide Key = Key(driver.KeyKPDivide)
KeyKPEnter Key = Key(driver.KeyKPEnter)
KeyKPEqual Key = Key(driver.KeyKPEqual)
KeyKPMultiply Key = Key(driver.KeyKPMultiply)
KeyKPSubtract Key = Key(driver.KeyKPSubtract)
KeyLeft Key = Key(driver.KeyLeft)
KeyLeftBracket Key = Key(driver.KeyLeftBracket)
KeyMenu Key = Key(driver.KeyMenu)
KeyMinus Key = Key(driver.KeyMinus)
KeyNumLock Key = Key(driver.KeyNumLock)
KeyPageDown Key = Key(driver.KeyPageDown)
KeyPageUp Key = Key(driver.KeyPageUp)
KeyPause Key = Key(driver.KeyPause)
KeyPeriod Key = Key(driver.KeyPeriod)
KeyPrintScreen Key = Key(driver.KeyPrintScreen)
KeyRight Key = Key(driver.KeyRight)
KeyRightBracket Key = Key(driver.KeyRightBracket)
KeyScrollLock Key = Key(driver.KeyScrollLock)
KeySemicolon Key = Key(driver.KeySemicolon)
KeyShift Key = Key(driver.KeyShift)
KeySlash Key = Key(driver.KeySlash)
KeySpace Key = Key(driver.KeySpace)
KeyTab Key = Key(driver.KeyTab)
KeyUp Key = Key(driver.KeyUp)
KeyMax Key = KeyUp
)