mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
driver: Remove some arguments from UI.Run
This commit is contained in:
parent
8013fef9ea
commit
8b995b086b
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
2
run.go
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user