ui: Reduce arguments from newUIContext

This commit is contained in:
Hajime Hoshi 2019-12-16 10:57:57 +09:00
parent 664cf62a29
commit 6a8013ed37
3 changed files with 8 additions and 6 deletions

View File

@ -94,9 +94,11 @@ func (u *UserInterface) Update() {
}
type UserInterface struct {
// TODO: Remove these members: the driver layer should not care about the game screen size.
width int
height int
scale float64
sizeChanged bool
// Used for gomobile-build

4
run.go
View File

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

View File

@ -51,7 +51,7 @@ func (d *defaultGame) Layout(outsideWidth, outsideHeight int) (screenWidth, scre
return w, h
}
func newUIContext(game Game, width, height int, scaleForWindow float64) *uiContext {
func newUIContext(game Game, scaleForWindow float64) *uiContext {
u := &uiContext{
game: game,
scaleForWindow: scaleForWindow,