Oh the vast sweeping changes, and they're not even close to complete, but

things compile and most things run so this is a good time to checkpoint.
Let me recall:

- Refactored the whole scene deal.
- Revamped the XML parser stuff (now uses Digester).
- Rethought the tile management.
- Started tile bundle stuff.
- Wrote some tests.
- Did a bit of Mike-ification.

Onward and moreward.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@621 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-11-18 04:09:23 +00:00
parent 45251dba8c
commit ae1052a371
77 changed files with 2188 additions and 3512 deletions
@@ -1,5 +1,5 @@
//
// $Id: TileUtil.java,v 1.1 2001/10/11 00:41:26 shaper Exp $
// $Id: TileUtil.java,v 1.2 2001/11/18 04:09:21 mdb Exp $
package com.threerings.media.tile;
@@ -14,33 +14,36 @@ public class TileUtil
{
/**
* Returns the image associated with the given tile from the given
* tile manager, or null if an error occurred. Any exceptions
* that occur are logged.
* tile manager, or null if an error occurred. Any exceptions that
* occur are logged.
*
* @param tilemgr the tile manager via which the tile should be
* fetched.
* @param tileSetId the id of the tileset from which to fetch the
* tile.
* @param tileIndex the index of the tile to be fetched.
*/
public static Image getTileImage (TileManager tilemgr, int tsid, int tid)
public static Image getTileImage (
TileManager tilemgr, int tileSetId, int tileIndex)
{
try {
Tile tile = tilemgr.getTile(tsid, tid);
return tile.img;
TileSet set = tilemgr.getTileSet(tileSetId);
return set.getTileImage(tileIndex);
} catch (TileException te) {
Log.warning("Exception retrieving tile image [te=" + te + "].");
Log.warning("Error retrieving tile image [error=" + te + "].");
return null;
}
}
/**
* Returns the given tile from the given tile manager, or null if
* an error occurred. Any exceptions that occur are logged.
* Generates a fully-qualified tileid given the supplied tileset id
* and tile index. This fully-qualified id can be used to fetch the
* tile from the tileset repository which knows about the supplied
* tileset id.
*/
public static Tile getTile (TileManager tilemgr, int tsid, int tid)
public static int getFQTileId (int tileSetId, int tileIndex)
{
try {
return tilemgr.getTile(tsid, tid);
} catch (TileException te) {
Log.warning("Exception retrieving tile [te=" + te + "].");
return null;
}
return (tileSetId << 16) | tileIndex;
}
}