mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
parent
8567c3c654
commit
f4b12462e6
@ -96,7 +96,7 @@ type game struct {
|
||||
}
|
||||
|
||||
func (g *game) Layout(outsideWidth, outsideHeight int) (int, int) {
|
||||
// As game implements the interface FloatLayouter, Layout is never called and LayoutF is called instead.
|
||||
// As game implements the interface LayoutFer, Layout is never called and LayoutF is called instead.
|
||||
// However, game has to implement Layout to satisfy the interface Game.
|
||||
panic("windowsize: Layout must not be called")
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func (g *gameForUI) NewScreenImage(width, height int) *ui.Image {
|
||||
}
|
||||
|
||||
func (g *gameForUI) Layout(outsideWidth, outsideHeight float64) (float64, float64) {
|
||||
if l, ok := g.game.(FloatLayouter); ok {
|
||||
if l, ok := g.game.(LayoutFer); ok {
|
||||
return l.LayoutF(outsideWidth, outsideHeight)
|
||||
}
|
||||
|
||||
|
6
run.go
6
run.go
@ -80,12 +80,12 @@ type Game interface {
|
||||
// You can return a fixed screen size if you don't care, or you can also return a calculated screen size
|
||||
// adjusted with the given outside size.
|
||||
//
|
||||
// If the game implements the interface FloatLayouter, Layout is never called and LayoutF is called instead.
|
||||
// If the game implements the interface LayoutFer, Layout is never called and LayoutF is called instead.
|
||||
Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)
|
||||
}
|
||||
|
||||
// FloatLayouter is an interface for the float version of Game.Layout.
|
||||
type FloatLayouter interface {
|
||||
// LayoutFer is an interface for the float version of Game.Layout.
|
||||
type LayoutFer interface {
|
||||
// LayoutF is the float version of Game.Layout.
|
||||
//
|
||||
// If the game implements this interface, Layout is never called and LayoutF is called instead.
|
||||
|
Loading…
Reference in New Issue
Block a user