More work on object tiles. Simplified tile set manager as the editor
will now obtain tile set information directly from the tile sets. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@446 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
//
|
||||
// $Id: ObjectTile.java,v 1.1 2001/10/11 00:41:26 shaper Exp $
|
||||
// $Id: ObjectTile.java,v 1.2 2001/10/12 00:38:15 shaper Exp $
|
||||
|
||||
package com.threerings.media.tile;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* An object tile extends the base tile to provide support for objects
|
||||
* whose image spans more than one tile. The object has dimensions
|
||||
* that represent its footprint or "shadow", which the scene
|
||||
* containing the tile can reference to do things like make the
|
||||
* footprint tiles impassable.
|
||||
* whose image spans more than one tile. An object tile has
|
||||
* dimensions that represent its footprint or "shadow", which the
|
||||
* scene containing the tile can then reference to do things like
|
||||
* making the footprint tiles impassable.
|
||||
*/
|
||||
public class ObjectTile extends Tile
|
||||
{
|
||||
@@ -28,13 +27,4 @@ public class ObjectTile extends Tile
|
||||
this.baseWidth = baseWidth;
|
||||
this.baseHeight = baseHeight;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx, Shape dest)
|
||||
{
|
||||
super.paint(gfx, dest);
|
||||
|
||||
// TODO: draw the object image offset to account for its
|
||||
// actual dimensions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: Tile.java,v 1.14 2001/10/11 00:41:26 shaper Exp $
|
||||
// $Id: Tile.java,v 1.15 2001/10/12 00:38:15 shaper Exp $
|
||||
|
||||
package com.threerings.media.tile;
|
||||
|
||||
@@ -49,8 +49,8 @@ public class Tile
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the tile into the given rectangle in the given graphics
|
||||
* context.
|
||||
* Render the tile image at the top-left corner of the given shape
|
||||
* in the given graphics context.
|
||||
*/
|
||||
public void paint (Graphics2D gfx, Shape dest)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//
|
||||
// $Id: TileSetManager.java,v 1.13 2001/10/11 00:41:26 shaper Exp $
|
||||
// $Id: TileSetManager.java,v 1.14 2001/10/12 00:38:15 shaper Exp $
|
||||
|
||||
package com.threerings.media.tile;
|
||||
|
||||
import com.threerings.media.ImageManager;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* The <code>TileSetManager</code> provides tileset management
|
||||
@@ -20,22 +20,12 @@ import java.util.ArrayList;
|
||||
public interface TileSetManager
|
||||
{
|
||||
/**
|
||||
* Return the total number of tiles in the specified tileset or -1
|
||||
* if the tileset is not found.
|
||||
* Return an <code>Iterator</code> over all <code>TileSet</code>
|
||||
* objects available.
|
||||
*
|
||||
* @param tsid the tileset identifier.
|
||||
* @return the number of tiles.
|
||||
* @return the tileset iterator.
|
||||
*/
|
||||
public int getNumTilesInSet (int tsid)
|
||||
throws NoSuchTileSetException;
|
||||
|
||||
/**
|
||||
* Return an <code>ArrayList</code> containing all
|
||||
* <code>TileSet</code> objects available.
|
||||
*
|
||||
* @return the list of tilesets.
|
||||
*/
|
||||
public ArrayList getAllTileSets ();
|
||||
public Iterator getTileSets ();
|
||||
|
||||
/**
|
||||
* Return the tileset object corresponding to the specified
|
||||
@@ -58,11 +48,4 @@ public interface TileSetManager
|
||||
*/
|
||||
public Tile getTile (int tsid, int tid)
|
||||
throws NoSuchTileSetException, NoSuchTileException;
|
||||
|
||||
/**
|
||||
* Return the total number of tilesets available for use.
|
||||
*
|
||||
* @return the number of tilesets.
|
||||
*/
|
||||
public int getNumTileSets ();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//
|
||||
// $Id: TileSetManagerImpl.java,v 1.13 2001/10/11 00:41:26 shaper Exp $
|
||||
// $Id: TileSetManagerImpl.java,v 1.14 2001/10/12 00:38:15 shaper Exp $
|
||||
|
||||
package com.threerings.media.tile;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.samskivert.util.*;
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.threerings.media.Log;
|
||||
public abstract class TileSetManagerImpl implements TileSetManager
|
||||
{
|
||||
/**
|
||||
* Initialize the <code>TileSetManager</code>.
|
||||
* Initialize the tile set manager.
|
||||
*
|
||||
* @param config the config object.
|
||||
* @param imgmgr the image manager.
|
||||
@@ -27,12 +27,7 @@ public abstract class TileSetManagerImpl implements TileSetManager
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public int getNumTilesInSet (int tsid)
|
||||
throws NoSuchTileSetException
|
||||
{
|
||||
return getTileSet(tsid).getNumTiles();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public TileSet getTileSet (int tsid)
|
||||
throws NoSuchTileSetException
|
||||
{
|
||||
@@ -44,24 +39,19 @@ public abstract class TileSetManagerImpl implements TileSetManager
|
||||
return tset;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public Iterator getTileSets ()
|
||||
{
|
||||
return Collections.unmodifiableMap(_tilesets).values().iterator();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public Tile getTile (int tsid, int tid)
|
||||
throws NoSuchTileSetException, NoSuchTileException
|
||||
{
|
||||
return getTileSet(tsid).getTile(_imgmgr, tid);
|
||||
}
|
||||
|
||||
public ArrayList getAllTileSets ()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
CollectionUtil.addAll(list, _tilesets.elements());
|
||||
return list;
|
||||
}
|
||||
|
||||
public int getNumTileSets ()
|
||||
{
|
||||
return _tilesets.size();
|
||||
}
|
||||
|
||||
/** The config object. */
|
||||
protected Config _config;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user