internal/ui: better panic message at ReadPixels before RunGame

Closes #2979
This commit is contained in:
Hajime Hoshi 2024-05-03 16:35:39 +09:00
parent 35e29a29e7
commit 903ab6727b

View File

@ -126,6 +126,10 @@ func newUserInterface() (*UserInterface, error) {
}
func (u *UserInterface) readPixels(mipmap *mipmap.Mipmap, pixels []byte, region image.Rectangle) error {
if !u.running.Load() {
panic("ui: ReadPixels cannot be called before the game starts")
}
ok, err := mipmap.ReadPixels(u.graphicsDriver, pixels, region)
if err != nil {
return err