mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +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.m.Lock()
|
||||||
u.sizeChanged = true
|
u.sizeChanged = true
|
||||||
u.context = context
|
|
||||||
u.m.Unlock()
|
u.m.Unlock()
|
||||||
|
|
||||||
|
u.context = context
|
||||||
|
|
||||||
if u.Graphics().IsGL() {
|
if u.Graphics().IsGL() {
|
||||||
var ctx gl.Context
|
var ctx gl.Context
|
||||||
if mainloop {
|
if mainloop {
|
||||||
@ -321,7 +322,7 @@ func (u *UserInterface) run(context driver.UIContext, mainloop bool) (err error)
|
|||||||
func (u *UserInterface) layoutIfNeeded() {
|
func (u *UserInterface) layoutIfNeeded() {
|
||||||
var outsideWidth, outsideHeight float64
|
var outsideWidth, outsideHeight float64
|
||||||
|
|
||||||
u.m.Lock()
|
u.m.RLock()
|
||||||
sizeChanged := u.sizeChanged
|
sizeChanged := u.sizeChanged
|
||||||
if sizeChanged {
|
if sizeChanged {
|
||||||
if u.gbuildWidthPx == 0 || u.gbuildHeightPx == 0 {
|
if u.gbuildWidthPx == 0 || u.gbuildHeightPx == 0 {
|
||||||
@ -335,7 +336,7 @@ func (u *UserInterface) layoutIfNeeded() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
u.sizeChanged = false
|
u.sizeChanged = false
|
||||||
u.m.Unlock()
|
u.m.RUnlock()
|
||||||
|
|
||||||
if sizeChanged {
|
if sizeChanged {
|
||||||
u.context.Layout(outsideWidth, outsideHeight)
|
u.context.Layout(outsideWidth, outsideHeight)
|
||||||
|
Loading…
Reference in New Issue
Block a user