local StaminaRenderSystem = inherited("StaminaRenderSystem", SystemMap)

function StaminaRenderSystem:new()
	local ms = instance(self)
	return ms
end

function StaminaRenderSystem:wants(ent)
	return ent.aspects.stamina and ent.aspects.hud_stamina and ent:is_stamina_not_full()
end

function StaminaRenderSystem:dynamic_wants(ent)
	return ent.aspects.stamina and ent.aspects.hud_stamina and ent:is_stamina_not_full()
end

function StaminaRenderSystem:ent_added(ent)
	ent.rx = ent.x
	ent.ry = ent.y
	ent.rz = ent.z
end

function StaminaRenderSystem:ent_removed(ent)
end

function StaminaRenderSystem:render(x, y, scale, perspective, angle, a, r, g, b)
	for ent in pairs(self.ents) do
		local rx = x + ent.rx*scale
		local ry = y + ent.ry*scale*perspective -ent.rz*scale
		ent:stamina_render(rx, ry, scale, perspective, angle, a, r, g, b)
	end
end

return StaminaRenderSystem