local a=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local C=a("\083\112\114\105\116\101")local P={}P.ClassName="\083\112\114\105\116\101\115\104\101\101\116"P.__index=P function P.new(a)local C=setmetatable({},P)C._texture=a or error("\110\111 \116\101\120\116\117\114\101")C._sprites={}return C end function P.AddSprite(Z,a,P,B)assert(not Z._sprites[a])local L=C.new({Texture=Z._texture,Position=P;Size=B;Name=tostring(a)})Z._sprites[a]=L end function P.GetSprite(C,a)if not a then warn("\091\083\112\114\105\116\101\115\104\101\101\116\046\071\101\116\083\112\114\105\116\101\093 - \073\109\097\103\101 \110\097\109\101 \099\097\110\110\111\116 \098\101 \110\105\108")return nil end local P=C._sprites[a]if P then return P end if typeof(a)=="\069\110\117\109\073\116\101\109"then P=C._sprites[a.Name]end return P end function P.HasSprite(C,a)return C:GetSprite(a)~=nil end return P
--- Data model for sprite sheets
-- @classmod Spritesheet

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local Sprite = require("Sprite")

local Spritesheet = {}
Spritesheet.ClassName = "Spritesheet"
Spritesheet.__index = Spritesheet

function Spritesheet.new(texture)
	local self = setmetatable({}, Spritesheet)

	self._texture = texture or error("no texture")
	self._sprites = {}

	return self
end

function Spritesheet:AddSprite(index, position, size)
	assert(not self._sprites[index])

	local sprite = Sprite.new({
		Texture = self._texture;
		Position = position;
		Size = size;
		Name = tostring(index);
	})

	self._sprites[index] = sprite
end

function Spritesheet:GetSprite(index)
	if not index then
		warn("[Spritesheet.GetSprite] - Image name cannot be nil")
		return nil
	end

	local sprite = self._sprites[index]
	if sprite then
		return sprite
	end

	if typeof(index) == "EnumItem" then
		sprite = self._sprites[index.Name]
	end

	return sprite
end

function Spritesheet:HasSprite(index)
	return self:GetSprite(index) ~= nil
end


return Spritesheet
