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