function IconController.setGameTheme(d)IconController.gameTheme=d local C=IconController.getIcons()for C,G in pairs(C)do G:setTheme(d)end end function IconController.setDisplayOrder(d)d=tonumber(d)or TopbarPlusGui.DisplayOrder TopbarPlusGui.DisplayOrder=d end IconController.setDisplayOrder(10)function IconController.getIcons()local d={}for C,G in pairs(topbarIcons)do table.insert(d,C)end return d end function IconController.getIcon(d)for C,G in pairs(topbarIcons)do if C.name==d then return C end end return false end function IconController.disableHealthbar(d)local C=d==nil or d IconController.healthbarDisabled=C IconController.healthbarDisabledSignal:Fire(C)end function IconController.disableControllerOption(d)local C=d==nil or d disableControllerOption=C if IconController.getIcon("\095\084\111\112\098\097\114\067\111\110\116\114\111\108\108\101\114\079\112\116\105\111\110")then IconController._determineControllerDisplay()end end function IconController.canShowIconOnTopbar(d)if(d.enabled==true or d.accountForWhenDisabled)and d.presentOnTopbar then return true end return false end function IconController.getMenuOffset(d)local C=d:get("\097\108\105\103\110\109\101\110\116")local G=IconController[C.."\071\097\112"]local W=0 local q=0 local Y=0 if d.menuOpen then local C=d:get("\109\101\110\117\083\105\122\101")local D=C.X.Offset local E=d:_getMenuDirection()if E=="\114\105\103\104\116"then q+=D+G/6 elseif E=="\108\101\102\116"then W=D+4 q+=G/3 Y=D end end return W,q,Y end
-- METHODS
function IconController.setGameTheme(theme)
	IconController.gameTheme = theme
	local icons = IconController.getIcons()
	for _, icon in pairs(icons) do
		icon:setTheme(theme)
	end
end

function IconController.setDisplayOrder(value)
	value = tonumber(value) or TopbarPlusGui.DisplayOrder
	TopbarPlusGui.DisplayOrder = value
end
IconController.setDisplayOrder(10)

function IconController.getIcons()
	local allIcons = {}
	for otherIcon, _ in pairs(topbarIcons) do
		table.insert(allIcons, otherIcon)
	end
	return allIcons
end

function IconController.getIcon(name)
	for otherIcon, _ in pairs(topbarIcons) do
		if otherIcon.name == name then
			return otherIcon
		end
	end
	return false
end

function IconController.disableHealthbar(bool)
	local finalBool = (bool == nil or bool)
	IconController.healthbarDisabled = finalBool
	IconController.healthbarDisabledSignal:Fire(finalBool)
end

function IconController.disableControllerOption(bool)
	local finalBool = (bool == nil or bool)
	disableControllerOption = finalBool
	if IconController.getIcon("_TopbarControllerOption") then
		IconController._determineControllerDisplay()
	end
end

function IconController.canShowIconOnTopbar(icon)
	if (icon.enabled == true or icon.accountForWhenDisabled) and icon.presentOnTopbar then
		return true
	end
	return false
end

function IconController.getMenuOffset(icon)
	local alignment = icon:get("alignment")
	local alignmentGap = IconController[alignment .. "Gap"]
	local extendLeft = 0
	local extendRight = 0
	local additionalRight = 0
	if icon.menuOpen then
		local menuSize = icon:get("menuSize")
		local menuSizeXOffset = menuSize.X.Offset
		local direction = icon:_getMenuDirection()
		if direction == "right" then
			extendRight += menuSizeXOffset + alignmentGap / 6 --2
		elseif direction == "left" then
			extendLeft = menuSizeXOffset + 4
			extendRight += alignmentGap / 3 --4
			additionalRight = menuSizeXOffset
		end
	end
	return extendLeft, extendRight, additionalRight
end
