mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-23 17:32:02 +01:00
Add function keys to example/keyboard
This commit is contained in:
parent
6bdc875596
commit
90ab31a872
@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/ebitenutil"
|
"github.com/hajimehoshi/ebiten/ebitenutil"
|
||||||
"log"
|
"log"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,6 +64,11 @@ func update(screen *ebiten.Image) error {
|
|||||||
pressed = append(pressed, string(c))
|
pressed = append(pressed, string(c))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for i := 1; i <= 12; i++ {
|
||||||
|
if ebiten.IsKeyPressed(ebiten.Key(i) + ebiten.KeyF1 - 1) {
|
||||||
|
pressed = append(pressed, "F"+strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
}
|
||||||
for key, name := range keyNames {
|
for key, name := range keyNames {
|
||||||
if ebiten.IsKeyPressed(key) {
|
if ebiten.IsKeyPressed(key) {
|
||||||
pressed = append(pressed, name)
|
pressed = append(pressed, name)
|
||||||
|
Loading…
Reference in New Issue
Block a user