mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/ui: refactoring: simplify ResetForFrame
Updating the layout is already done every frame, so doing this in ResetForFrame is not needed. Updates #490
This commit is contained in:
parent
7b164882fc
commit
6a8e45e6c1
@ -1350,12 +1350,6 @@ func (u *UserInterface) IsScreenTransparent() bool {
|
||||
}
|
||||
|
||||
func (u *UserInterface) ResetForFrame() {
|
||||
// The offscreens must be updated every frame (#490).
|
||||
var w, h float64
|
||||
u.t.Call(func() {
|
||||
w, h = u.updateSize()
|
||||
})
|
||||
u.context.layout(w, h)
|
||||
u.input.resetForFrame()
|
||||
|
||||
u.m.Lock()
|
||||
|
@ -637,7 +637,6 @@ func (u *UserInterface) IsScreenTransparent() bool {
|
||||
}
|
||||
|
||||
func (u *UserInterface) ResetForFrame() {
|
||||
u.updateSize()
|
||||
u.input.resetForFrame()
|
||||
}
|
||||
|
||||
|
@ -290,8 +290,6 @@ func (u *UserInterface) run(context Context, mainloop bool) (err error) {
|
||||
<-u.setGBuildSizeCh
|
||||
}
|
||||
|
||||
// Force to set the screen size
|
||||
u.layoutIfNeeded()
|
||||
for {
|
||||
if err := u.update(); err != nil {
|
||||
return err
|
||||
@ -330,6 +328,7 @@ func (u *UserInterface) update() error {
|
||||
renderEndCh <- struct{}{}
|
||||
}()
|
||||
|
||||
u.layoutIfNeeded()
|
||||
if err := u.context.updateFrame(deviceScale()); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -433,7 +432,6 @@ func (u *UserInterface) IsScreenTransparent() bool {
|
||||
}
|
||||
|
||||
func (u *UserInterface) ResetForFrame() {
|
||||
u.layoutIfNeeded()
|
||||
u.input.resetForFrame()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user