Hey Guys,
I basically want to know if any of you have had problems with (custom loaded) icons disappearing (going invisible) when you change resolution? This doesn't seem to effect the stock icons, only the icons in my icon manager instance.
The only thing I can think of that is different about they way mine are done is that they are loaded dynamically at runtime rather than at loadtime. I would rather not have to reload all the icons every time the resolution changes, but if needs must... I'm crossing my fingers it's just something stupid that I've done!
Here is my (badly commented) icon manager code;
class IconManager:
def __init__(self, sName):
self.__dIcons = {}
self.__sName = sName
self.__iPointer = 0
self.__pNode = App.g_kIconManager.GetIconGroup(self.__sName)
if not self.__pNode:
App.g_kIconManager.RegisterIconGroup(self.__sName, __name__, "Dummy")
self.__pNode = App.g_kIconManager.CreateIconGroup(self.__sName)
App.g_kIconManager.AddIconGroup(self.__pNode)
loddebug("Icons:\t" + "Created the Icon Group for " + self.__sName)
def __str__(self):
""" Return a the icon groups name as a string. """
return str(self.__sName)
def VerboseGetName(self):
""" Get the name of this icon mananger. """
return str(self.__sName)
def AddIcon(self,sPath, W, H, X=0, Y=0):
""" Add (and load) an icon into the icon manager. Cache it under it's file path. """
iIconID = self.GetIcon(sPath)
if (iIconID is None):
self.__iPointer = self.__iPointer + 1
pTextureHandle = self.__pNode.LoadIconTexture(sPath)
self.__pNode.SetIconLocation(self.__iPointer,pTextureHandle, X, Y, W, H)
self.__dIcons[sPath] = self.__iPointer
iIconID = self.__iPointer
loddebug("Icons:\t" + "Loading Icon at " + sPath)
return iIconID
def GetIcon(self,sPath):
""" Get the icon number from the cache. """
if self.__dIcons.has_key(sPath):
return self.__dIcons[sPath]
else:
return None
def Delete(self):
""" Delete this icon manager. """
loddebug("Icons:\t" + "Destroying the Icon Group for " + self.__sName)
App.g_kIconManager.DeleteIconGroup(self.__sName)