mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
uidriver/mobile: Refactoring
This commit is contained in:
parent
b796582d14
commit
08308a7edf
@ -102,7 +102,7 @@ func getDeviceScale() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// appMain is the main routine for gomobile-build mode.
|
// appMain is the main routine for gomobile-build mode.
|
||||||
func appMain(a app.App) {
|
func (u *UserInterface) appMain(a app.App) {
|
||||||
var glctx gl.Context
|
var glctx gl.Context
|
||||||
touches := map[touch.Sequence]*driver.Touch{}
|
touches := map[touch.Sequence]*driver.Touch{}
|
||||||
for e := range a.Events() {
|
for e := range a.Events() {
|
||||||
@ -122,7 +122,7 @@ func appMain(a app.App) {
|
|||||||
glctx = nil
|
glctx = nil
|
||||||
}
|
}
|
||||||
case size.Event:
|
case size.Event:
|
||||||
theUI.setFullscreenImpl(e.WidthPx, e.HeightPx)
|
u.setFullscreenImpl(e.WidthPx, e.HeightPx)
|
||||||
case paint.Event:
|
case paint.Event:
|
||||||
if glctx == nil || e.External {
|
if glctx == nil || e.External {
|
||||||
continue
|
continue
|
||||||
@ -149,7 +149,7 @@ func appMain(a app.App) {
|
|||||||
for _, t := range touches {
|
for _, t := range touches {
|
||||||
ts = append(ts, t)
|
ts = append(ts, t)
|
||||||
}
|
}
|
||||||
theUI.input.update(ts)
|
u.input.update(ts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ func (u *UserInterface) Loop(ch <-chan error) error {
|
|||||||
err := <-ch
|
err := <-ch
|
||||||
panic(err)
|
panic(err)
|
||||||
}()
|
}()
|
||||||
app.Main(appMain)
|
app.Main(u.appMain)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user