mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
abcacc26d8
commit
05dd36ec7b
@ -34,6 +34,7 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
"github.com/hajimehoshi/ebiten/v2/examples/resources/fonts"
|
||||
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
|
||||
"github.com/hajimehoshi/ebiten/v2/inpututil"
|
||||
"github.com/hajimehoshi/ebiten/v2/text"
|
||||
)
|
||||
|
||||
@ -79,9 +80,11 @@ type Game struct {
|
||||
func (g *Game) Update() error {
|
||||
g.count++
|
||||
|
||||
if runtime.GOOS == "js" && ebiten.IsKeyPressed(ebiten.KeyF) {
|
||||
if runtime.GOOS == "js" {
|
||||
if ebiten.IsKeyPressed(ebiten.KeyF) || len(inpututil.AppendJustPressedTouchIDs(nil)) > 0 {
|
||||
ebiten.SetFullscreen(true)
|
||||
}
|
||||
}
|
||||
if runtime.GOOS != "js" && ebiten.IsKeyPressed(ebiten.KeyQ) {
|
||||
return regularTermination
|
||||
}
|
||||
@ -105,7 +108,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
||||
fw, fh := ebiten.ScreenSizeInFullscreen()
|
||||
msg := "This is an example of the finest fullscreen.\n"
|
||||
if runtime.GOOS == "js" {
|
||||
msg += "Press F to enter fullscreen (again).\n"
|
||||
msg += "Press F or touch the screen to enter fullscreen (again).\n"
|
||||
} else {
|
||||
msg += "Press Q to quit.\n"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user