mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
uidriver/mobile: Refactoring
This commit is contained in:
parent
12878571f6
commit
e19f38bd4f
@ -287,9 +287,10 @@ func (u *UserInterface) run(context driver.UIContext, mainloop bool) (err error)
|
||||
|
||||
u.m.Lock()
|
||||
u.sizeChanged = true
|
||||
u.context = context
|
||||
u.m.Unlock()
|
||||
|
||||
u.context = context
|
||||
|
||||
if u.Graphics().IsGL() {
|
||||
var ctx gl.Context
|
||||
if mainloop {
|
||||
@ -321,7 +322,7 @@ func (u *UserInterface) run(context driver.UIContext, mainloop bool) (err error)
|
||||
func (u *UserInterface) layoutIfNeeded() {
|
||||
var outsideWidth, outsideHeight float64
|
||||
|
||||
u.m.Lock()
|
||||
u.m.RLock()
|
||||
sizeChanged := u.sizeChanged
|
||||
if sizeChanged {
|
||||
if u.gbuildWidthPx == 0 || u.gbuildHeightPx == 0 {
|
||||
@ -335,7 +336,7 @@ func (u *UserInterface) layoutIfNeeded() {
|
||||
}
|
||||
}
|
||||
u.sizeChanged = false
|
||||
u.m.Unlock()
|
||||
u.m.RUnlock()
|
||||
|
||||
if sizeChanged {
|
||||
u.context.Layout(outsideWidth, outsideHeight)
|
||||
|
Loading…
Reference in New Issue
Block a user