Updated for new tile world order.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@464 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2001-11-24 04:29:04 +00:00
parent 003d16daf0
commit e4964afd9c
2 changed files with 19 additions and 16 deletions
@@ -18,7 +18,7 @@ import com.samskivert.swing.HGroupLayout;
import com.samskivert.swing.VGroupLayout; import com.samskivert.swing.VGroupLayout;
import com.threerings.resource.ResourceManager; import com.threerings.resource.ResourceManager;
import com.threerings.media.ImageManager; import com.threerings.media.tile.TileManager;
import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.client.PlaceView; import com.threerings.crowd.client.PlaceView;
@@ -107,8 +107,8 @@ public class VenisonPanel
public void ancestorAdded (AncestorEvent event) { public void ancestorAdded (AncestorEvent event) {
// create our image manager // create our image manager
JRootPane rpane = getRootPane(); JRootPane rpane = getRootPane();
VenisonTile.setImageManager( TileManager tmgr = new TileManager(_rmgr);
new ImageManager(_rmgr, (Frame)rpane.getParent())); VenisonTile.setTileManager(tmgr);
} }
public void ancestorMoved (AncestorEvent event) { public void ancestorMoved (AncestorEvent event) {
} }
@@ -142,10 +142,9 @@ public class VenisonPanel
// this stuff is all a bit of a hack right now. by all rights, the // this stuff is all a bit of a hack right now. by all rights, the
// venison app should set up the resource manager, because it knows // venison app should set up the resource manager, because it knows
// about that sort of stuff, and make it available via the venison // about that sort of stuff, and make it available via the venison
// context and we may have some better place for the image manager to // context and we may have some better place for the tile manager to
// live and the tile set would be fetched through the tile // live. but it's late and i want to get this working, so fooey.
// manager. but it's late and i want to get this working, so fooey.
/** Our resource manager. */ /** Our resource manager. */
protected static ResourceManager _rmgr = new ResourceManager("rsrc"); protected static ResourceManager _rmgr = new ResourceManager(null, "rsrc");
} }
@@ -1,5 +1,5 @@
// //
// $Id: AtlantiTile.java,v 1.11 2001/11/08 08:00:22 mdb Exp $ // $Id: AtlantiTile.java,v 1.12 2001/11/24 04:29:04 mdb Exp $
package com.threerings.venison; package com.threerings.venison;
@@ -17,9 +17,9 @@ import java.util.List;
import com.samskivert.util.IntTuple; import com.samskivert.util.IntTuple;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.threerings.media.ImageManager;
import com.threerings.media.tile.NoSuchTileException; import com.threerings.media.tile.NoSuchTileException;
import com.threerings.media.tile.Tile; import com.threerings.media.tile.Tile;
import com.threerings.media.tile.TileManager;
import com.threerings.media.tile.UniformTileSet; import com.threerings.media.tile.UniformTileSet;
import com.threerings.presents.dobj.DSet; import com.threerings.presents.dobj.DSet;
@@ -423,9 +423,9 @@ public class VenisonTile
* Someone needs to configure this so that we can display tiles on * Someone needs to configure this so that we can display tiles on
* screen. * screen.
*/ */
public static void setImageManager (ImageManager imgr) public static void setTileManager (TileManager tmgr)
{ {
_imgr = imgr; _tmgr = tmgr;
} }
/** /**
@@ -435,15 +435,19 @@ public class VenisonTile
{ {
// load up the tile set if we haven't already // load up the tile set if we haven't already
if (_tset == null) { if (_tset == null) {
_tset = new UniformTileSet( _tset = new UniformTileSet();
_imgr, TILES_IMG_PATH, TILE_TYPES, TILE_WIDTH, TILE_HEIGHT); _tset.setTileCount(TILE_TYPES);
_tset.setWidth(TILE_WIDTH);
_tset.setHeight(TILE_HEIGHT);
_tset.setImagePath(TILES_IMG_PATH);
_tset.setImageProvider(_tmgr);
} }
// fetch the tile // fetch the tile
try { try {
Tile tile = _tset.getTile(type-1); Tile tile = _tset.getTile(type-1);
if (tile != null) { if (tile != null) {
return tile.img; return tile.getImage();
} }
} catch (NoSuchTileException nste) { } catch (NoSuchTileException nste) {
@@ -457,8 +461,8 @@ public class VenisonTile
/** The tile image that we use to render this tile. */ /** The tile image that we use to render this tile. */
protected Image _tileImage; protected Image _tileImage;
/** Our image manager. */ /** Our tile manager. */
protected static ImageManager _imgr; protected static TileManager _tmgr;
/** Our tileset. */ /** Our tileset. */
protected static UniformTileSet _tset; protected static UniformTileSet _tset;