diff --git a/example/keyboard/main.go b/example/keyboard/main.go index 724ea568c..b9d85d6fa 100644 --- a/example/keyboard/main.go +++ b/example/keyboard/main.go @@ -19,6 +19,7 @@ import ( "github.com/hajimehoshi/ebiten/ebitenutil" "log" "sort" + "strconv" "strings" ) @@ -63,6 +64,11 @@ func update(screen *ebiten.Image) error { 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 { if ebiten.IsKeyPressed(key) { pressed = append(pressed, name)