From 1be6b546b70b189b7cd41d05444c640be7a92427 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 3 Sep 2016 17:54:04 +0900 Subject: [PATCH] ui: Bug fix: SetScreenSize/Scale must be called after Run --- run.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run.go b/run.go index e483e05f7..994b0cbf5 100644 --- a/run.go +++ b/run.go @@ -115,6 +115,9 @@ func RunWithoutMainLoop(f func(*Image) error, width, height int, scale float64, // // This function is concurrent-safe. func SetScreenSize(width, height int) { + if !loop.IsRunning() { + panic("ebiten: Run is not called yet") + } if width <= 0 || height <= 0 { panic("ebiten: width and height must be positive") } @@ -127,6 +130,9 @@ func SetScreenSize(width, height int) { // // This function is concurrent-safe. func SetScreenScale(scale float64) { + if !loop.IsRunning() { + panic("ebiten: Run is not called yet") + } if scale <= 0 { panic("ebiten: scale must be positive") }