class SFML::SpriteSheet

A grid-based slice of a texture. Where TextureAtlas loads an already-packed sheet with named frames, SpriteSheet slices a uniformly-gridded image into numbered frames at load time.

Use a SpriteSheet when your art is a regular grid (run cycles baked at 32Γ—32 cells); use a TextureAtlas when frames are densely packed at irregular sizes.

sheet = SFML::SpriteSheet.load(β€œhero.png”, frame_size: [32, 32])

sheet.frame_count # 8 if the image is 256Γ—32 sheet.region(0) # SFML::Rect of the first cell sheet.sprite(0) # ready-to-draw SFML::Sprite of the first cell

frame_size can be a [w, h] pair (one number for both if frame_size: 32). padding and margin let you skip pixels between cells and around the edge respectively β€” common when the source image has separators or a 1px outline to prevent bleed.