From b5d8be96a6ebb63b31dbfa92e9f86171356f6efa Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 25 Nov 2019 00:12:06 +0900 Subject: [PATCH] mobile: Move Game definition to package ebiten Updates #943 --- mobile/mobile.go | 16 +--------------- run.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/mobile/mobile.go b/mobile/mobile.go index eceed154f..e320127db 100644 --- a/mobile/mobile.go +++ b/mobile/mobile.go @@ -24,21 +24,7 @@ import ( ) // Game defines necessary functions for a mobile game. -type Game interface { - // Update updates a game by one frame. - Update(*ebiten.Image) error - - // Layout accepts a native view size in DP (device-independent pixels) and returns the game's logical screen - // size. - // - // The screen scale is automatically adjusted to fit the view. - // - // Layout is called at an initialization and whenever the view size is changed. - // - // 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 view size. - Layout(viewWidth, viewHeight int) (screenWidth, screenHeight int) -} +type Game = ebiten.Game // SetGame sets a mobile game. // diff --git a/run.go b/run.go index 2005b817f..988327927 100644 --- a/run.go +++ b/run.go @@ -24,6 +24,25 @@ import ( var _ = __EBITEN_REQUIRES_GO_VERSION_1_12_OR_LATER__ +// Game defines necessary functions for a game. +// +// Note: This interface is not used anywhere yet. +type Game interface { + // Update updates a game by one frame. + Update(*Image) error + + // Layout accepts a native outside size in DP (device-independent pixels) and returns the game's logical + // screen size. + // + // The screen scale is automatically adjusted to fit the outside. + // + // Layout is called at an initialization and whenever the outside size is changed. + // + // 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. + Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) +} + // TPS represents a default ticks per second, that represents how many times game updating happens in a second. const DefaultTPS = 60