diff --git a/src/java/com/threerings/media/IconManager.java b/src/java/com/threerings/media/IconManager.java index ff78dce76..dfd04a5e6 100644 --- a/src/java/com/threerings/media/IconManager.java +++ b/src/java/com/threerings/media/IconManager.java @@ -1,5 +1,5 @@ // -// $Id: IconManager.java,v 1.5 2002/12/07 02:13:00 shaper Exp $ +// $Id: IconManager.java,v 1.6 2003/05/13 21:33:58 ray Exp $ package com.threerings.media; @@ -32,10 +32,10 @@ import com.threerings.media.tile.TileSet; * *
* arrows.path = /rsrc/media/icons/arrows.png - * arrows.metrics = 4, 20, 20 # 4 icons that are 20x20 + * arrows.metrics = 20, 25 # icons that are 20 pixels wide and 25 pixels tall * * smileys.path = /rsrc/media/icons/smileys.png - * smileys.metrics = 10, 16, 16 # 16 icons that are 16x16 + * smileys.metrics = 16, 16 # icons that are 16 pixels square ** * A user could then request an
arrows icon like so:
@@ -107,7 +107,7 @@ public class IconManager
}
int[] metrics = StringUtil.parseIntArray(metstr);
- if (metrics == null || metrics.length != 3) {
+ if (metrics == null || metrics.length != 2) {
throw new Exception("Invalid icon set metrics " +
"[metrics=" + metstr + "]");
}
@@ -115,10 +115,10 @@ public class IconManager
// load up the tileset
if (_rsrcSet == null) {
set = _tilemgr.loadTileSet(
- path, metrics[0], metrics[1], metrics[2]);
+ path, metrics[0], metrics[1]);
} else {
set = _tilemgr.loadTileSet(
- _rsrcSet, path, metrics[0], metrics[1], metrics[2]);
+ _rsrcSet, path, metrics[0], metrics[1]);
}
// cache it
diff --git a/src/java/com/threerings/media/tile/TileManager.java b/src/java/com/threerings/media/tile/TileManager.java
index 5dbb4167f..cb3d48dcb 100644
--- a/src/java/com/threerings/media/tile/TileManager.java
+++ b/src/java/com/threerings/media/tile/TileManager.java
@@ -1,5 +1,5 @@
//
-// $Id: TileManager.java,v 1.32 2003/05/05 22:34:48 ray Exp $
+// $Id: TileManager.java,v 1.33 2003/05/13 21:33:58 ray Exp $
package com.threerings.media.tile;
@@ -57,10 +57,9 @@ public class TileManager
* Loads up a tileset from the specified image with the specified
* metadata parameters.
*/
- public UniformTileSet loadTileSet (
- String imgPath, int count, int width, int height)
+ public UniformTileSet loadTileSet (String imgPath, int width, int height)
{
- return loadCachedTileSet("", imgPath, count, width, height);
+ return loadCachedTileSet("", imgPath, width, height);
}
/**
@@ -68,20 +67,20 @@ public class TileManager
* specified resource set) with the specified metadata parameters.
*/
public UniformTileSet loadTileSet (
- String rset, String imgPath, int count, int width, int height)
+ String rset, String imgPath, int width, int height)
{
return loadTileSet(
- getImageProvider(rset), rset, imgPath, count, width, height);
+ getImageProvider(rset), rset, imgPath, width, height);
}
/**
*/
public UniformTileSet loadTileSet (
ImageProvider improv, String improvKey, String imgPath,
- int count, int width, int height)
+ int width, int height)
{
UniformTileSet uts = loadCachedTileSet(
- improvKey, imgPath, count, width, height);
+ improvKey, imgPath, width, height);
uts.setImageProvider(improv);
return uts;
}
@@ -99,7 +98,7 @@ public class TileManager
* Used to load and cache tilesets loaded via {@link #loadTileSet}.
*/
protected UniformTileSet loadCachedTileSet (
- String bundle, String imgPath, int count, int width, int height)
+ String bundle, String imgPath, int width, int height)
{
String key = bundle + "::" + imgPath;
UniformTileSet uts = (UniformTileSet)_handcache.get(key);
@@ -107,7 +106,6 @@ public class TileManager
uts = new UniformTileSet();
uts.setImageProvider(_defaultProvider);
uts.setImagePath(imgPath);
- uts.setTileCount(count);
uts.setWidth(width);
uts.setHeight(height);
_handcache.put(key, uts);
diff --git a/src/java/com/threerings/media/tile/UniformTileSet.java b/src/java/com/threerings/media/tile/UniformTileSet.java
index 757efddce..1c0170f57 100644
--- a/src/java/com/threerings/media/tile/UniformTileSet.java
+++ b/src/java/com/threerings/media/tile/UniformTileSet.java
@@ -1,5 +1,5 @@
//
-// $Id: UniformTileSet.java,v 1.13 2003/05/02 23:32:56 mdb Exp $
+// $Id: UniformTileSet.java,v 1.14 2003/05/13 21:33:58 ray Exp $
package com.threerings.media.tile;
@@ -18,16 +18,10 @@ public class UniformTileSet extends TileSet
// documentation inherited
public int getTileCount ()
{
- return _count;
- }
-
- /**
- * Specifies the number of tiles that will be found in the tileset
- * image managed by this tileset.
- */
- public void setTileCount (int tileCount)
- {
- _count = tileCount;
+ BufferedImage tsimg = getRawTileSetImage();
+ int perRow = tsimg.getWidth() / _width;
+ int perCol = tsimg.getHeight() / _height;
+ return perRow * perCol;
}
/**
@@ -90,9 +84,6 @@ public class UniformTileSet extends TileSet
buf.append(", height=").append(_height);
}
- /** The total number of tiles in this tileset. */
- protected int _count;
-
/** The width (in pixels) of the tiles in this tileset. */
protected int _width;
diff --git a/src/java/com/threerings/media/tile/bundle/tools/DumpBundle.java b/src/java/com/threerings/media/tile/bundle/tools/DumpBundle.java
index 4e7ed6c9a..33056d498 100644
--- a/src/java/com/threerings/media/tile/bundle/tools/DumpBundle.java
+++ b/src/java/com/threerings/media/tile/bundle/tools/DumpBundle.java
@@ -1,5 +1,5 @@
//
-// $Id: DumpBundle.java,v 1.9 2003/01/13 22:49:47 mdb Exp $
+// $Id: DumpBundle.java,v 1.10 2003/05/13 21:33:58 ray Exp $
package com.threerings.media.tile.bundle.tools;
@@ -52,7 +52,7 @@ public class DumpBundle
TileSet set = tsb.getTileSet(tsid.intValue());
System.out.println(tsid + " => " + set);
if (dumpTiles) {
- for (int t = 0; t < set.getTileCount(); t++) {
+ for (int t = 0, nn = set.getTileCount(); t < nn; t++) {
System.out.println(" " + t + " => " +
set.getTile(t));
}
diff --git a/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java b/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java
index 76da3e66d..9b4427110 100644
--- a/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java
+++ b/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java
@@ -1,5 +1,5 @@
//
-// $Id: TileSetBundler.java,v 1.15 2003/04/27 06:34:43 mdb Exp $
+// $Id: TileSetBundler.java,v 1.16 2003/05/13 21:33:58 ray Exp $
package com.threerings.media.tile.bundle.tools;
@@ -367,7 +367,6 @@ public class TileSetBundler
ets.setName(set.getName());
ets.setWidth(50);
ets.setHeight(50);
- ets.setTileCount(1);
ets.setImagePath(imagePath);
bundle.addTileSet(tileSetId, ets);
// and write an error image to the jar file
diff --git a/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java b/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java
index 5f0a3a636..25c22866c 100644
--- a/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java
+++ b/src/java/com/threerings/media/tile/tools/xml/UniformTileSetRuleSet.java
@@ -1,5 +1,5 @@
//
-// $Id: UniformTileSetRuleSet.java,v 1.7 2002/02/05 20:29:10 mdb Exp $
+// $Id: UniformTileSetRuleSet.java,v 1.8 2003/05/13 21:33:58 ray Exp $
package com.threerings.media.tile.tools.xml;
@@ -21,8 +21,6 @@ import com.threerings.media.tile.UniformTileSet;
* <width>64</width>
* <!-- the height of each tile in pixels -->
* <height>48</height>
- * <!-- the total number of tiles in the set -->
- * <tileCount>16</tileCount>
* </tileset>
*
*/
@@ -39,9 +37,6 @@ public class UniformTileSetRuleSet extends TileSetRuleSet
digester.addCallMethod(
_prefix + TILESET_PATH + "/height", "setHeight", 0,
new Class[] { java.lang.Integer.TYPE });
- digester.addCallMethod(
- _prefix + TILESET_PATH + "/tileCount", "setTileCount", 0,
- new Class[] { java.lang.Integer.TYPE });
}
// documentation inherited
@@ -64,13 +59,6 @@ public class UniformTileSetRuleSet extends TileSetRuleSet
valid = false;
}
- // check for a