Allow placement of the selected tile in scenes undergoing edit in the

scene editor application.  Added comments.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@53 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-07-16 22:12:01 +00:00
parent 6806cfb6f7
commit ab18d9742e
10 changed files with 100 additions and 53 deletions
@@ -1,5 +1,5 @@
//
// $Id: TileManager.java,v 1.3 2001/07/16 18:59:31 shaper Exp $
// $Id: TileManager.java,v 1.4 2001/07/16 22:12:01 shaper Exp $
package com.threerings.cocktail.miso.tile;
@@ -10,17 +10,22 @@ import com.samskivert.util.IntMap;
import java.awt.*;
/**
* Provides a simplified interface for retrieving tile objects from
* various tilesets, by name or identifier, and manages caching of
* tiles and related resources as appropriate.
* Provides a simplified interface for managing multiple tilesets and
* tiles.
*/
public class TileManager
{
/**
* Initialize the tile manager with the given TileSetManager object.
*/
public TileManager (TileSetManager tsmgr)
{
_tsmgr = tsmgr;
}
/**
* Return the total number of tiles in the specified tileset.
*/
public int getNumTilesInSet (int tsid)
{
TileSet tset = _tsmgr.getTileSet(tsid);
@@ -28,11 +33,18 @@ public class TileManager
return tset.getNumTiles();
}
/**
* Return a String array of all tileset names ordered by ascending
* tileset id.
*/
public String[] getTileSetNames ()
{
return _tsmgr.getTileSetNames();
}
/**
* Return the Tile object for the specified tileset and tile id.
*/
public Tile getTile (int tsid, int tid)
{
// the fully unique tile id is the conjoined tile set and tile id
@@ -55,7 +67,7 @@ public class TileManager
_tiles.put(utid, tile);
Log.info("Loaded tile into cache [tsid="+tsid+", tid="+tid+"].");
// Log.info("Loaded tile into cache [tsid="+tsid+", tid="+tid+"].");
return tile;
}
@@ -1,5 +1,5 @@
//
// $Id: TileSet.java,v 1.4 2001/07/16 18:59:31 shaper Exp $
// $Id: TileSet.java,v 1.5 2001/07/16 22:12:01 shaper Exp $
package com.threerings.cocktail.miso.tile;
@@ -73,9 +73,9 @@ public class TileSet
{
// load the full tile image if we don't already have it
if (_imgTiles == null) {
Log.info("Getting full tileset image [file=" + _file + "].");
if ((_imgTiles = ImageManager.getImage(_file)) == null) {
Log.warning("Failed to retrieve full tileset image.");
Log.warning("Failed to retrieve full tileset image " +
"[file=" + _file + "].");
return null;
}
}