type Spritesheet = object texture: Texture2D spriteWidth, spriteHeight: int sprites: seq[Rectangle] proc loadSpritesheet(path: string, columns, rows: int): Spritesheet = result = Spritesheet() result.texture = loadTexture(path) result.spriteWidth = int32(result.texture.width / columns) result.spriteHeight = int32(result.texture.height / rows) for y in 0 ..< rows: for x in 0 ..< columns: result.sprites.add( Rectangle( x: float32(x  result.spriteWidth), y: float32(y  result.spriteHeight), width: float32(result.spriteWidth), height: float32(result.spriteHeight) ) ) proc drawSprite(s: Spritesheet, index: int, pos: Vector2, rotation, scale: float32) = drawTexture(s.texture, s.sprites[index], Rectangle( x: pos.x, y: pos.y, width: s.spriteWidth.float32  scale, height: s.spriteHeight.float32  scale ), Vector2(x: 0, y: 0), rotation, White )```