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")
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
DeviceScaleFactor() float64

View File

@ -554,7 +554,7 @@ func init() {
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).
u.t = thread.New()
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)
canvas.Call("focus")
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.
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)
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 {
return nil
}