ad7b64d4a1
Made TileSet an interface. Throw exceptions for unknown tile or tile set requests. General clean-up and documentation. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@427 542714f4-19e9-0310-aa3c-eee0fc999fb1
47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
//
|
|
// $Id: TileUtil.java,v 1.1 2001/10/11 00:41:26 shaper Exp $
|
|
|
|
package com.threerings.media.tile;
|
|
|
|
import java.awt.Image;
|
|
|
|
import com.threerings.media.Log;
|
|
|
|
/**
|
|
* Miscellaneous utility routines for working with tiles.
|
|
*/
|
|
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.
|
|
*/
|
|
public static Image getTileImage (TileManager tilemgr, int tsid, int tid)
|
|
{
|
|
try {
|
|
Tile tile = tilemgr.getTile(tsid, tid);
|
|
return tile.img;
|
|
|
|
} catch (TileException te) {
|
|
Log.warning("Exception retrieving tile image [te=" + te + "].");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Returns the given tile from the given tile manager, or null if
|
|
* an error occurred. Any exceptions that occur are logged.
|
|
*/
|
|
public static Tile getTile (TileManager tilemgr, int tsid, int tid)
|
|
{
|
|
try {
|
|
return tilemgr.getTile(tsid, tid);
|
|
|
|
} catch (TileException te) {
|
|
Log.warning("Exception retrieving tile [te=" + te + "].");
|
|
return null;
|
|
}
|
|
}
|
|
}
|