Skip to content

Commit

Permalink
input: Add numpad keys except for Edge browser (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Apr 13, 2018
1 parent 30cb4ba commit 5229e5a
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 0 deletions.
13 changes: 13 additions & 0 deletions genkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ func init() {
for i := 1; i <= 12; i++ {
nameToCodes["F"+strconv.Itoa(i)] = []string{"F" + strconv.Itoa(i)}
}
// Numpad
// https://www.w3.org/TR/uievents-code/#key-numpad-section
for c := '0'; c <= '9'; c++ {
nameToCodes["KP"+string(c)] = []string{"Numpad" + string(c)}
}
nameToCodes["KPDecimal"] = []string{"NumpadDecimal"}
nameToCodes["KPDivide"] = []string{"NumpadDivide"}
nameToCodes["KPMultiply"] = []string{"NumpadMultiply"}
nameToCodes["KPSubtract"] = []string{"NumpadSubtract"}
nameToCodes["KPAdd"] = []string{"NumpadAdd"}
nameToCodes["KPEnter"] = []string{"NumpadEnter"}
nameToCodes["KPEqual"] = []string{"NumpadEqual"}
}

func init() {
Expand Down Expand Up @@ -129,6 +141,7 @@ func init() {
for i := 1; i <= 12; i++ {
keyCodeToNameEdge[0x70+i-1] = "F" + strconv.Itoa(i)
}
// TODO: Add numpad keys
}

const ebitenKeysTmpl = `{{.License}}
Expand Down
17 changes: 17 additions & 0 deletions internal/input/keys.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions internal/input/keys_glfw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions internal/input/keys_js.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions keys.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5229e5a

Please sign in to comment.