mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/ui: refactoring: remove sizeChanged for js
It is safe to call Layout every frame.
This commit is contained in:
parent
e2f0878a4c
commit
cffa123405
@ -57,8 +57,6 @@ type UserInterface struct {
|
|||||||
cursorShape CursorShape
|
cursorShape CursorShape
|
||||||
onceUpdateCalled bool
|
onceUpdateCalled bool
|
||||||
|
|
||||||
sizeChanged bool
|
|
||||||
|
|
||||||
lastDeviceScaleFactor float64
|
lastDeviceScaleFactor float64
|
||||||
|
|
||||||
context *contextImpl
|
context *contextImpl
|
||||||
@ -67,7 +65,6 @@ type UserInterface struct {
|
|||||||
|
|
||||||
var theUI = &UserInterface{
|
var theUI = &UserInterface{
|
||||||
runnableOnUnfocused: true,
|
runnableOnUnfocused: true,
|
||||||
sizeChanged: true,
|
|
||||||
initFocused: true,
|
initFocused: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,22 +226,19 @@ func (u *UserInterface) updateSize() {
|
|||||||
}
|
}
|
||||||
u.lastDeviceScaleFactor = a
|
u.lastDeviceScaleFactor = a
|
||||||
|
|
||||||
if u.sizeChanged {
|
switch {
|
||||||
u.sizeChanged = false
|
case document.Truthy():
|
||||||
switch {
|
body := document.Get("body")
|
||||||
case document.Truthy():
|
bw := body.Get("clientWidth").Float()
|
||||||
body := document.Get("body")
|
bh := body.Get("clientHeight").Float()
|
||||||
bw := body.Get("clientWidth").Float()
|
u.context.layout(bw, bh)
|
||||||
bh := body.Get("clientHeight").Float()
|
case go2cpp.Truthy():
|
||||||
u.context.layout(bw, bh)
|
w := go2cpp.Get("screenWidth").Float()
|
||||||
case go2cpp.Truthy():
|
h := go2cpp.Get("screenHeight").Float()
|
||||||
w := go2cpp.Get("screenWidth").Float()
|
u.context.layout(w, h)
|
||||||
h := go2cpp.Get("screenHeight").Float()
|
default:
|
||||||
u.context.layout(w, h)
|
// Node.js
|
||||||
default:
|
u.context.layout(640, 480)
|
||||||
// Node.js
|
|
||||||
u.context.layout(640, 480)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +605,6 @@ func (u *UserInterface) updateScreenSize() {
|
|||||||
case go2cpp.Truthy():
|
case go2cpp.Truthy():
|
||||||
// TODO: Implement this
|
// TODO: Implement this
|
||||||
}
|
}
|
||||||
u.sizeChanged = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) SetScreenTransparent(transparent bool) {
|
func (u *UserInterface) SetScreenTransparent(transparent bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user