From bfa94359062cfd769f334a86016af103d8ae67ee Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 10 May 2024 18:24:47 +0900 Subject: [PATCH] ebiten: add comments about Layout and LayoutF Updates #2988 --- run.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/run.go b/run.go index 683795da8..2291562e5 100644 --- a/run.go +++ b/run.go @@ -64,7 +64,8 @@ type Game interface { Draw(screen *Image) // 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 // 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. // // 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) }