input: Add KeyNumLock (#580)

This commit is contained in:
Hajime Hoshi 2018-04-13 01:18:54 +09:00
parent 5229e5a713
commit dd6110fbf8
5 changed files with 9 additions and 0 deletions

View File

@ -69,6 +69,7 @@ func init() {
"Backslash": {"Backslash"}, "Backslash": {"Backslash"},
"RightBracket": {"BracketRight"}, "RightBracket": {"BracketRight"},
"GraveAccent": {"Backquote"}, "GraveAccent": {"Backquote"},
"NumLock": {"NumLock"},
} }
// ASCII: 0 - 9 // ASCII: 0 - 9
for c := '0'; c <= '9'; c++ { for c := '0'; c <= '9'; c++ {

View File

@ -103,6 +103,7 @@ const (
KeyLeft KeyLeft
KeyLeftBracket KeyLeftBracket
KeyMinus KeyMinus
KeyNumLock
KeyPageDown KeyPageDown
KeyPageUp KeyPageUp
KeyPeriod KeyPeriod

View File

@ -108,6 +108,7 @@ var glfwKeyCodeToKey = map[glfw.Key]Key{
glfw.KeyLeft: KeyLeft, glfw.KeyLeft: KeyLeft,
glfw.KeyLeftBracket: KeyLeftBracket, glfw.KeyLeftBracket: KeyLeftBracket,
glfw.KeyMinus: KeyMinus, glfw.KeyMinus: KeyMinus,
glfw.KeyNumLock: KeyNumLock,
glfw.KeyPageDown: KeyPageDown, glfw.KeyPageDown: KeyPageDown,
glfw.KeyPageUp: KeyPageUp, glfw.KeyPageUp: KeyPageUp,
glfw.KeyPeriod: KeyPeriod, glfw.KeyPeriod: KeyPeriod,

View File

@ -235,6 +235,9 @@ var keyToCodes = map[Key][]string{
KeyN: { KeyN: {
"KeyN", "KeyN",
}, },
KeyNumLock: {
"NumLock",
},
KeyO: { KeyO: {
"KeyO", "KeyO",
}, },

View File

@ -113,6 +113,7 @@ const (
KeyLeft Key = Key(input.KeyLeft) KeyLeft Key = Key(input.KeyLeft)
KeyLeftBracket Key = Key(input.KeyLeftBracket) KeyLeftBracket Key = Key(input.KeyLeftBracket)
KeyMinus Key = Key(input.KeyMinus) KeyMinus Key = Key(input.KeyMinus)
KeyNumLock Key = Key(input.KeyNumLock)
KeyPageDown Key = Key(input.KeyPageDown) KeyPageDown Key = Key(input.KeyPageDown)
KeyPageUp Key = Key(input.KeyPageUp) KeyPageUp Key = Key(input.KeyPageUp)
KeyPeriod Key = Key(input.KeyPeriod) KeyPeriod Key = Key(input.KeyPeriod)
@ -297,6 +298,8 @@ func keyNameToKey(name string) (Key, bool) {
return KeyLeftBracket, true return KeyLeftBracket, true
case "minus": case "minus":
return KeyMinus, true return KeyMinus, true
case "numlock":
return KeyNumLock, true
case "pagedown": case "pagedown":
return KeyPageDown, true return KeyPageDown, true
case "pageup": case "pageup":