mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-28 12:48:54 +01:00
ui: Bug fix: SetScreenSize/Scale must be called after Run
This commit is contained in:
parent
24e124948d
commit
1be6b546b7
6
run.go
6
run.go
@ -115,6 +115,9 @@ func RunWithoutMainLoop(f func(*Image) error, width, height int, scale float64,
|
|||||||
//
|
//
|
||||||
// This function is concurrent-safe.
|
// This function is concurrent-safe.
|
||||||
func SetScreenSize(width, height int) {
|
func SetScreenSize(width, height int) {
|
||||||
|
if !loop.IsRunning() {
|
||||||
|
panic("ebiten: Run is not called yet")
|
||||||
|
}
|
||||||
if width <= 0 || height <= 0 {
|
if width <= 0 || height <= 0 {
|
||||||
panic("ebiten: width and height must be positive")
|
panic("ebiten: width and height must be positive")
|
||||||
}
|
}
|
||||||
@ -127,6 +130,9 @@ func SetScreenSize(width, height int) {
|
|||||||
//
|
//
|
||||||
// This function is concurrent-safe.
|
// This function is concurrent-safe.
|
||||||
func SetScreenScale(scale float64) {
|
func SetScreenScale(scale float64) {
|
||||||
|
if !loop.IsRunning() {
|
||||||
|
panic("ebiten: Run is not called yet")
|
||||||
|
}
|
||||||
if scale <= 0 {
|
if scale <= 0 {
|
||||||
panic("ebiten: scale must be positive")
|
panic("ebiten: scale must be positive")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user