SpriteSheet constructor

SpriteSheet({
  1. required Image image,
  2. required Vector2 srcSize,
  3. double margin = 0,
  4. double spacing = 0,
})

Creates a sprite sheet given the image and the tile size.

Implementation

SpriteSheet({
  required this.image,
  required this.srcSize,
  this.margin = 0,
  this.spacing = 0,
})  : columns = (image.width - 2 * margin + spacing) ~/ (srcSize.x + spacing),
      rows = (image.height - 2 * margin + spacing) ~/ (srcSize.y + spacing);