mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 19:58:54 +01:00
ui: Reduce arguments from newUIContext
This commit is contained in:
parent
664cf62a29
commit
6a8013ed37
@ -94,9 +94,11 @@ func (u *UserInterface) Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UserInterface struct {
|
type UserInterface struct {
|
||||||
width int
|
// TODO: Remove these members: the driver layer should not care about the game screen size.
|
||||||
height int
|
width int
|
||||||
scale float64
|
height int
|
||||||
|
scale float64
|
||||||
|
|
||||||
sizeChanged bool
|
sizeChanged bool
|
||||||
|
|
||||||
// Used for gomobile-build
|
// Used for gomobile-build
|
||||||
|
4
run.go
4
run.go
@ -155,7 +155,7 @@ func Run(f func(*Image) error, width, height int, scale float64, title string) e
|
|||||||
height: height,
|
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 := uiDriver().Run(width, height, scale, title, theUIContext, graphicsDriver()); err != nil {
|
||||||
if err == driver.RegularTermination {
|
if err == driver.RegularTermination {
|
||||||
return nil
|
return nil
|
||||||
@ -178,7 +178,7 @@ func RunWithoutMainLoop(f func(*Image) error, width, height int, scale float64,
|
|||||||
height: height,
|
height: height,
|
||||||
}
|
}
|
||||||
|
|
||||||
theUIContext = newUIContext(game, width, height, scale)
|
theUIContext = newUIContext(game, scale)
|
||||||
return uiDriver().RunWithoutMainLoop(width, height, scale, title, theUIContext, graphicsDriver())
|
return uiDriver().RunWithoutMainLoop(width, height, scale, title, theUIContext, graphicsDriver())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ func (d *defaultGame) Layout(outsideWidth, outsideHeight int) (screenWidth, scre
|
|||||||
return w, h
|
return w, h
|
||||||
}
|
}
|
||||||
|
|
||||||
func newUIContext(game Game, width, height int, scaleForWindow float64) *uiContext {
|
func newUIContext(game Game, scaleForWindow float64) *uiContext {
|
||||||
u := &uiContext{
|
u := &uiContext{
|
||||||
game: game,
|
game: game,
|
||||||
scaleForWindow: scaleForWindow,
|
scaleForWindow: scaleForWindow,
|
||||||
|
Loading…
Reference in New Issue
Block a user