ebiten: add comments about Layout and LayoutF

Updates #2988
This commit is contained in:
Hajime Hoshi 2024-05-10 18:24:47 +09:00
parent db454548be
commit bfa9435906

8
run.go
View File

@ -64,7 +64,8 @@ type Game interface {
Draw(screen *Image) Draw(screen *Image)
// Layout accepts a native outside size in device-independent pixels and returns the game's logical screen // Layout accepts a native outside size in device-independent pixels and returns the game's logical screen
// size. // size in pixels. The logical size is used for 1) the screen size given at Draw and 2) calculation of the
// scale from the screen to the final screen size.
// //
// On desktops, the outside is a window or a monitor (fullscreen mode). On browsers, the outside is a body // On desktops, the outside is a window or a monitor (fullscreen mode). On browsers, the outside is a body
// element. On mobiles, the outside is the view's size. // element. On mobiles, the outside is the view's size.
@ -90,6 +91,11 @@ type LayoutFer interface {
// LayoutF is the float version of Game.Layout. // LayoutF is the float version of Game.Layout.
// //
// If the game implements this interface, Layout is never called and LayoutF is called instead. // If the game implements this interface, Layout is never called and LayoutF is called instead.
//
// LayoutF accepts a native outside size in device-independent pixels and returns the game's logical screen
// size in pixels. The logical size is used for 1) the screen size given at Draw and 2) calculation of the
// scale from the screen to the final screen size. For 1), the actual screen size is a rounded up of the
// logical size.
LayoutF(outsideWidth, outsideHeight float64) (screenWidth, screenHeight float64) LayoutF(outsideWidth, outsideHeight float64) (screenWidth, screenHeight float64)
} }