ui: Bug fix: SetScreenSize/Scale must be called after Run

This commit is contained in:
Hajime Hoshi 2016-09-03 17:54:04 +09:00
parent 24e124948d
commit 1be6b546b7

6
run.go
View File

@ -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")
}