mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 22:44:28 +01:00
examples/windowsize: Remove Q key to terminate
Not having a way to terminate the app is more portable. Browsers and mobiles don't have the notion of 'termination'.
This commit is contained in:
parent
30c185f254
commit
726de29f36
@ -18,7 +18,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
@ -73,13 +72,7 @@ func createRandomIconImage() image.Image {
|
|||||||
return img
|
return img
|
||||||
}
|
}
|
||||||
|
|
||||||
var terminated = errors.New("terminated")
|
|
||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyQ) {
|
|
||||||
return terminated
|
|
||||||
}
|
|
||||||
|
|
||||||
screenScale := ebiten.ScreenScale()
|
screenScale := ebiten.ScreenScale()
|
||||||
const d = 16
|
const d = 16
|
||||||
screenWidth, screenHeight := screen.Size()
|
screenWidth, screenHeight := screen.Size()
|
||||||
@ -187,7 +180,6 @@ Press C key to switch the cursor visibility
|
|||||||
Press I key to change the window icon
|
Press I key to change the window icon
|
||||||
Press V key to switch vsync
|
Press V key to switch vsync
|
||||||
Press T key to switch TPS (ticks per second)
|
Press T key to switch TPS (ticks per second)
|
||||||
Press Q key to quit
|
|
||||||
Cursor: (%d, %d)
|
Cursor: (%d, %d)
|
||||||
TPS: Current: %0.2f / Max: %s
|
TPS: Current: %0.2f / Max: %s
|
||||||
FPS: %0.2f
|
FPS: %0.2f
|
||||||
@ -222,7 +214,7 @@ func main() {
|
|||||||
|
|
||||||
ebiten.SetWindowDecorated(*windowDecorated)
|
ebiten.SetWindowDecorated(*windowDecorated)
|
||||||
|
|
||||||
if err := ebiten.Run(update, initScreenWidth, initScreenHeight, initScreenScale, "Window Size (Ebiten Demo)"); err != nil && err != terminated {
|
if err := ebiten.Run(update, initScreenWidth, initScreenHeight, initScreenScale, "Window Size (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user