driver: Remove some arguments from UI.Run

This commit is contained in:
Hajime Hoshi 2019-12-21 22:52:23 +09:00
parent 8013fef9ea
commit 8b995b086b
5 changed files with 5 additions and 5 deletions

View File

@ -31,7 +31,7 @@ type UIContext interface {
var RegularTermination = errors.New("regular termination") var RegularTermination = errors.New("regular termination")
type UI interface { type UI interface {
Run(width, height int, scale float64, title string, context UIContext, graphics Graphics) error Run(title string, context UIContext, graphics Graphics) error
RunWithoutMainLoop(width, height int, scale float64, title string, context UIContext, graphics Graphics) <-chan error RunWithoutMainLoop(width, height int, scale float64, title string, context UIContext, graphics Graphics) <-chan error
DeviceScaleFactor() float64 DeviceScaleFactor() float64

View File

@ -554,7 +554,7 @@ func init() {
runtime.LockOSThread() runtime.LockOSThread()
} }
func (u *UserInterface) Run(width, height int, scale float64, title string, uicontext driver.UIContext, graphics driver.Graphics) error { func (u *UserInterface) Run(title string, uicontext driver.UIContext, graphics driver.Graphics) error {
// Initialize the main thread first so the thread is available at u.run (#809). // Initialize the main thread first so the thread is available at u.run (#809).
u.t = thread.New() u.t = thread.New()
u.graphics = graphics u.graphics = graphics

View File

@ -403,7 +403,7 @@ func init() {
})) }))
} }
func (u *UserInterface) Run(width, height int, scale float64, title string, context driver.UIContext, graphics driver.Graphics) error { func (u *UserInterface) Run(title string, context driver.UIContext, graphics driver.Graphics) error {
document.Set("title", title) document.Set("title", title)
canvas.Call("focus") canvas.Call("focus")
u.running = true u.running = true

View File

@ -183,7 +183,7 @@ func (u *UserInterface) appMain(a app.App) {
} }
} }
func (u *UserInterface) Run(width, height int, scale float64, title string, context driver.UIContext, graphics driver.Graphics) error { func (u *UserInterface) Run(title string, context driver.UIContext, graphics driver.Graphics) error {
// TODO: Remove width/height/scale arguments. They are not used from gomobile-build. // TODO: Remove width/height/scale arguments. They are not used from gomobile-build.
u.setGBuildSizeCh = make(chan struct{}) u.setGBuildSizeCh = make(chan struct{})

2
run.go
View File

@ -157,7 +157,7 @@ func Run(f func(*Image) error, width, height int, scale float64, title string) e
theUIContext = newUIContext(game, scale) theUIContext = newUIContext(game, scale)
fixWindowPosition(int(float64(width)*scale), int(float64(height)*scale)) fixWindowPosition(int(float64(width)*scale), int(float64(height)*scale))
if err := uiDriver().Run(width, height, scale, title, theUIContext, graphicsDriver()); err != nil { if err := uiDriver().Run(title, theUIContext, graphicsDriver()); err != nil {
if err == driver.RegularTermination { if err == driver.RegularTermination {
return nil return nil
} }