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"},
"RightBracket": {"BracketRight"},
"GraveAccent": {"Backquote"},
"NumLock": {"NumLock"},
}
// ASCII: 0 - 9
for c := '0'; c <= '9'; c++ {

View File

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

View File

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

View File

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

View File

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