mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
uidriver/js: Bug fix: Needed to initialize pseudoScale with the given scale
Updates #960, #973
This commit is contained in:
parent
b8da9cf041
commit
49a5a2bf4e
@ -70,8 +70,6 @@ func update(screen *ebiten.Image) error {
|
|||||||
screenScale = 2
|
screenScale = 2
|
||||||
case 2:
|
case 2:
|
||||||
screenScale = 1
|
screenScale = 1
|
||||||
case 0:
|
|
||||||
// screenScale can be 0 on browsers or mobiles. Ignore this.
|
|
||||||
default:
|
default:
|
||||||
panic("not reached")
|
panic("not reached")
|
||||||
}
|
}
|
||||||
@ -79,9 +77,7 @@ func update(screen *ebiten.Image) error {
|
|||||||
if inpututil.IsKeyJustPressed(ebiten.KeyF) {
|
if inpututil.IsKeyJustPressed(ebiten.KeyF) {
|
||||||
fullscreen = !fullscreen
|
fullscreen = !fullscreen
|
||||||
}
|
}
|
||||||
if screenScale > 0 {
|
ebiten.SetScreenScale(screenScale)
|
||||||
ebiten.SetScreenScale(screenScale)
|
|
||||||
}
|
|
||||||
ebiten.SetFullscreen(fullscreen)
|
ebiten.SetFullscreen(fullscreen)
|
||||||
|
|
||||||
if ebiten.IsDrawingSkipped() {
|
if ebiten.IsDrawingSkipped() {
|
||||||
|
@ -108,8 +108,6 @@ func update(screen *ebiten.Image) error {
|
|||||||
screenScale = 2
|
screenScale = 2
|
||||||
case 2:
|
case 2:
|
||||||
screenScale = 0.75
|
screenScale = 0.75
|
||||||
case 0:
|
|
||||||
// screenScale can be 0 on browsers or mobiles. Ignore this.
|
|
||||||
default:
|
default:
|
||||||
panic("not reached")
|
panic("not reached")
|
||||||
}
|
}
|
||||||
@ -142,9 +140,7 @@ func update(screen *ebiten.Image) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ebiten.SetScreenSize(screenWidth, screenHeight)
|
ebiten.SetScreenSize(screenWidth, screenHeight)
|
||||||
if screenScale > 0 {
|
ebiten.SetScreenScale(screenScale)
|
||||||
ebiten.SetScreenScale(screenScale)
|
|
||||||
}
|
|
||||||
ebiten.SetFullscreen(fullscreen)
|
ebiten.SetFullscreen(fullscreen)
|
||||||
ebiten.SetRunnableInBackground(runnableInBackground)
|
ebiten.SetRunnableInBackground(runnableInBackground)
|
||||||
ebiten.SetCursorVisible(cursorVisible)
|
ebiten.SetCursorVisible(cursorVisible)
|
||||||
|
@ -424,6 +424,7 @@ func (u *UserInterface) Run(width, height int, scale float64, title string, cont
|
|||||||
|
|
||||||
document.Set("title", title)
|
document.Set("title", title)
|
||||||
u.setScreenSize(width, height)
|
u.setScreenSize(width, height)
|
||||||
|
u.pseudoScale = scale
|
||||||
canvas.Call("focus")
|
canvas.Call("focus")
|
||||||
ch := u.loop(context)
|
ch := u.loop(context)
|
||||||
if runtime.GOARCH == "wasm" {
|
if runtime.GOARCH == "wasm" {
|
||||||
|
2
run.go
2
run.go
@ -240,7 +240,7 @@ func SetScreenScale(scale float64) {
|
|||||||
|
|
||||||
// ScreenScale returns the current screen scale.
|
// ScreenScale returns the current screen scale.
|
||||||
//
|
//
|
||||||
// ScreenScale returns a value set by SetScreenScale or Run on browsers.
|
// On browsers, this value does not affect actual rendering.
|
||||||
//
|
//
|
||||||
// If Run is not called, this returns 0.
|
// If Run is not called, this returns 0.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user