Now supports loading icons from resource bundles.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1814 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: IconManager.java,v 1.2 2002/05/06 18:08:32 mdb Exp $
|
||||
// $Id: IconManager.java,v 1.3 2002/10/17 17:43:21 mdb Exp $
|
||||
|
||||
package com.threerings.media;
|
||||
|
||||
@@ -76,6 +76,15 @@ public class IconManager
|
||||
_config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* If icon images should be loaded from a set of resource bundles
|
||||
* rather than the classpath, that set can be set here.
|
||||
*/
|
||||
public void setSource (String resourceSet)
|
||||
{
|
||||
_rsrcSet = resourceSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the icon with the specified index from the named icon set.
|
||||
*/
|
||||
@@ -104,8 +113,13 @@ public class IconManager
|
||||
}
|
||||
|
||||
// load up the tileset
|
||||
set = _tilemgr.loadTileSet(
|
||||
path, metrics[0], metrics[1], metrics[2]);
|
||||
if (_rsrcSet == null) {
|
||||
set = _tilemgr.loadTileSet(
|
||||
path, metrics[0], metrics[1], metrics[2]);
|
||||
} else {
|
||||
set = _tilemgr.loadTileSet(
|
||||
_rsrcSet, path, metrics[0], metrics[1], metrics[2]);
|
||||
}
|
||||
|
||||
// cache it
|
||||
_icons.put(iconSet, set);
|
||||
@@ -132,6 +146,10 @@ public class IconManager
|
||||
/** Our configuration information. */
|
||||
protected Properties _config;
|
||||
|
||||
/** The resource bundle from which we load icon images, or null if
|
||||
* they should be loaded from the classpath. */
|
||||
protected String _rsrcSet;
|
||||
|
||||
/** A cache of our icon tilesets. TODO: use a real LRU cache instead
|
||||
* of a hash map. */
|
||||
protected HashMap _icons = new HashMap();
|
||||
|
||||
Reference in New Issue
Block a user