SpriteSheet.fromColumnsAndRows constructor

SpriteSheet.fromColumnsAndRows({
  1. required Image image,
  2. required int columns,
  3. required int rows,
  4. double spacing = 0,
  5. double margin = 0,
})

Implementation

SpriteSheet.fromColumnsAndRows({
  required this.image,
  required this.columns,
  required this.rows,
  this.spacing = 0,
  this.margin = 0,
}) : srcSize = Vector2(
        (image.width - 2 * margin - (columns - 1) * spacing) / columns,
        (image.height - 2 * margin - (rows - 1) * spacing) / rows,
      );