check max images, use copy

This commit is contained in:
2024-03-25 12:36:37 +01:00
parent 490afb1d76
commit 8cd2d74a8b
3 changed files with 5 additions and 3 deletions

View File

@@ -144,6 +144,10 @@ func SanitiyCheck(conf *Config) error {
return fmt.Errorf("at least 1 image must be specified") return fmt.Errorf("at least 1 image must be specified")
} }
if len(conf.Image) > 4 {
return fmt.Errorf("only 4 images can be specified")
}
if conf.Shader == "" { if conf.Shader == "" {
return fmt.Errorf("shader file must be specified") return fmt.Errorf("shader file must be specified")
} }

View File

@@ -141,9 +141,7 @@ func (game *Game) Draw(screen *ebiten.Image) {
"Mouse": []float64{float64(mousex), float64(mousey)}, "Mouse": []float64{float64(mousex), float64(mousey)},
} }
for idx, image := range game.Images { copy(op.Images[:3], game.Images)
op.Images[idx] = image
}
op.GeoM.Translate(float64(game.Conf.X), float64(game.Conf.Y)) op.GeoM.Translate(float64(game.Conf.X), float64(game.Conf.Y))

Binary file not shown.