mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
examples/windowsize: Bug fix: Suppress calling SetWindowPosition if the position is not updated
This is a temoprary fix for the issue that the window size unexpectedly shrunk on Linux. Updates #1607 Closes #1605
This commit is contained in:
parent
47f569e473
commit
34be0371be
@ -134,6 +134,7 @@ func (g *game) Update() error {
|
|||||||
|
|
||||||
const d = 16
|
const d = 16
|
||||||
toUpdateWindowSize := false
|
toUpdateWindowSize := false
|
||||||
|
toUpdateWindowPosition := false
|
||||||
if ebiten.IsKeyPressed(ebiten.KeyShift) {
|
if ebiten.IsKeyPressed(ebiten.KeyShift) {
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyArrowDown) {
|
if inpututil.IsKeyJustPressed(ebiten.KeyArrowDown) {
|
||||||
screenHeight += d
|
screenHeight += d
|
||||||
@ -158,15 +159,19 @@ func (g *game) Update() error {
|
|||||||
} else {
|
} else {
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyArrowUp) {
|
if inpututil.IsKeyJustPressed(ebiten.KeyArrowUp) {
|
||||||
positionY -= d
|
positionY -= d
|
||||||
|
toUpdateWindowPosition = true
|
||||||
}
|
}
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyArrowDown) {
|
if inpututil.IsKeyJustPressed(ebiten.KeyArrowDown) {
|
||||||
positionY += d
|
positionY += d
|
||||||
|
toUpdateWindowPosition = true
|
||||||
}
|
}
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyArrowLeft) {
|
if inpututil.IsKeyJustPressed(ebiten.KeyArrowLeft) {
|
||||||
positionX -= d
|
positionX -= d
|
||||||
|
toUpdateWindowPosition = true
|
||||||
}
|
}
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyArrowRight) {
|
if inpututil.IsKeyJustPressed(ebiten.KeyArrowRight) {
|
||||||
positionX += d
|
positionX += d
|
||||||
|
toUpdateWindowPosition = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if inpututil.IsKeyJustPressed(ebiten.KeyS) && !*flagAutoAdjusting {
|
if inpututil.IsKeyJustPressed(ebiten.KeyS) && !*flagAutoAdjusting {
|
||||||
@ -250,7 +255,9 @@ func (g *game) Update() error {
|
|||||||
}
|
}
|
||||||
ebiten.SetMaxTPS(tps)
|
ebiten.SetMaxTPS(tps)
|
||||||
ebiten.SetWindowDecorated(decorated)
|
ebiten.SetWindowDecorated(decorated)
|
||||||
ebiten.SetWindowPosition(positionX, positionY)
|
if toUpdateWindowPosition {
|
||||||
|
ebiten.SetWindowPosition(positionX, positionY)
|
||||||
|
}
|
||||||
ebiten.SetWindowFloating(floating)
|
ebiten.SetWindowFloating(floating)
|
||||||
ebiten.SetScreenClearedEveryFrame(screenCleared)
|
ebiten.SetScreenClearedEveryFrame(screenCleared)
|
||||||
if maximize && ebiten.IsWindowResizable() {
|
if maximize && ebiten.IsWindowResizable() {
|
||||||
|
Loading…
Reference in New Issue
Block a user