Add backspace (not tested)

This commit is contained in:
Hajime Hoshi 2015-01-07 11:22:25 +09:00
parent 62d1395670
commit 9f40da41fc
5 changed files with 6 additions and 0 deletions

View File

@ -55,6 +55,8 @@ func init() {
0x27: "Right", 0x27: "Right",
0x26: "Up", 0x26: "Up",
0x1B: "Escape", 0x1B: "Escape",
// The keys not listed in the Mozilla site:
0x08: "Backspace",
} }
// ASCII: 0 - 9 // ASCII: 0 - 9
for c := '0'; c <= '9'; c++ { for c := '0'; c <= '9'; c++ {

View File

@ -53,6 +53,7 @@ const (
KeyX KeyX
KeyY KeyY
KeyZ KeyZ
KeyBackspace
KeyCapsLock KeyCapsLock
KeyComma KeyComma
KeyDelete KeyDelete

View File

@ -57,6 +57,7 @@ var glfwKeyCodeToKey = map[glfw.Key]Key{
glfw.KeyX: KeyX, glfw.KeyX: KeyX,
glfw.KeyY: KeyY, glfw.KeyY: KeyY,
glfw.KeyZ: KeyZ, glfw.KeyZ: KeyZ,
glfw.KeyBackspace: KeyBackspace,
glfw.KeyCapsLock: KeyCapsLock, glfw.KeyCapsLock: KeyCapsLock,
glfw.KeyComma: KeyComma, glfw.KeyComma: KeyComma,
glfw.KeyDelete: KeyDelete, glfw.KeyDelete: KeyDelete,

View File

@ -17,6 +17,7 @@
package ui package ui
var keyCodeToKey = map[int]Key{ var keyCodeToKey = map[int]Key{
8: KeyBackspace,
9: KeyTab, 9: KeyTab,
13: KeyEnter, 13: KeyEnter,
16: KeyLeftShift, 16: KeyLeftShift,

View File

@ -59,6 +59,7 @@ const (
KeyX = Key(ui.KeyX) KeyX = Key(ui.KeyX)
KeyY = Key(ui.KeyY) KeyY = Key(ui.KeyY)
KeyZ = Key(ui.KeyZ) KeyZ = Key(ui.KeyZ)
KeyBackspace = Key(ui.KeyBackspace)
KeyCapsLock = Key(ui.KeyCapsLock) KeyCapsLock = Key(ui.KeyCapsLock)
KeyComma = Key(ui.KeyComma) KeyComma = Key(ui.KeyComma)
KeyDelete = Key(ui.KeyDelete) KeyDelete = Key(ui.KeyDelete)