Skip to content

Commit

Permalink
issue-hajimehoshi#3121, monitor-switching-issue-solution
Browse files Browse the repository at this point in the history
  • Loading branch information
pransh62390 committed Nov 3, 2024
1 parent c13e4fe commit 972905e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions image.go
Original file line number Diff line number Diff line change
Expand Up @@ -1225,12 +1225,16 @@ func newImage(bounds image.Rectangle, imageType atlas.ImageType) *Image {
}

width, height := bounds.Dx(), bounds.Dy()
if width <= 0 {
panic(fmt.Sprintf("ebiten: width at NewImage must be positive but %d", width))
}
if height <= 0 {
panic(fmt.Sprintf("ebiten: height at NewImage must be positive but %d", height))
}
// if width <= 0 {
// panic(fmt.Sprintf("ebiten: width at NewImage must be positive but %d", width))
// }
// if height <= 0 {
// panic(fmt.Sprintf("ebiten: height at NewImage must be positive but %d", height))
// }
if width <= 0 || height <= 0 {
fmt.Printf("Warning: Received invalid dimensions (width=%d, height=%d). Setting default values.", width, height)
width, height = 100, 100
}

i := &Image{
image: ui.Get().NewImage(width, height, imageType),
Expand Down

0 comments on commit 972905e

Please sign in to comment.