ebiten: Refactoring

This commit is contained in:
Hajime Hoshi 2021-04-17 17:30:48 +09:00
parent 161b1965ba
commit 54ac6bed1e
2 changed files with 3 additions and 3 deletions

4
run.go
View File

@ -165,7 +165,7 @@ func (i *imageDumperGame) Layout(outsideWidth, outsideHeight int) (screenWidth,
func RunGame(game Game) error {
defer atomic.StoreInt32(&isRunGameEnded_, 1)
fixWindowPosition(WindowSize())
initializeWindowPositionIfNeeded(WindowSize())
theUIContext.set(&imageDumperGame{
game: game,
})
@ -190,7 +190,7 @@ func isRunGameEnded() bool {
//
// TODO: Remove this. In order to remove this, the uiContext should be in another package.
func RunGameWithoutMainLoop(game Game) {
fixWindowPosition(WindowSize())
initializeWindowPositionIfNeeded(WindowSize())
theUIContext.set(&imageDumperGame{
game: game,
})

View File

@ -147,7 +147,7 @@ var (
windowPositionSetExplicitly uint32
)
func fixWindowPosition(width, height int) {
func initializeWindowPositionIfNeeded(width, height int) {
w := uiDriver().Window()
if w == nil {
return