Various changes to support changes in the Narya library.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2276 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-02-12 07:24:08 +00:00
parent 5bca9e5397
commit a8a2d9b1ba
9 changed files with 64 additions and 65 deletions
@@ -1,5 +1,5 @@
//
// $Id: ScrollingScene.java,v 1.11 2003/01/31 23:11:07 mdb Exp $
// $Id: ScrollingScene.java,v 1.12 2003/02/12 07:24:07 mdb Exp $
package com.threerings.miso.client;
@@ -26,7 +26,7 @@ import com.threerings.miso.util.MisoContext;
/**
* Provides an infinite array of tiles in which to scroll.
*/
public class ScrollingScene implements DisplayMisoScene
public class ScrollingScene extends VirtualDisplayMisoSceneImpl
{
public ScrollingScene (MisoContext ctx)
throws NoSuchTileSetException, NoSuchTileException, PersistenceException
@@ -34,21 +34,25 @@ public class ScrollingScene implements DisplayMisoScene
// locate the water tileset
TileSetRepository tsrepo = ctx.getTileManager().getTileSetRepository();
Iterator iter = tsrepo.enumerateTileSets();
TileSet wtset = null;
String tsname = null;
while (iter.hasNext()) {
TileSet tset = (TileSet)iter.next();
// yay for built-in regex support!
if (tset.getName().matches(".*[Ww]ater.*") &&
tset instanceof BaseTileSet) {
wtset = tset;
tsname = tset.getName();
break;
}
}
if (wtset == null) {
if (tsname == null) {
throw new RuntimeException("Unable to locate water tileset.");
}
// now we look the tileset up by name so that it is properly
// initialized and all that business
TileSet wtset = ctx.getTileManager().getTileSet(tsname);
// grab our four repeating tiles
_tiles = new BaseTile[wtset.getTileCount()];
for (int ii = 0; ii < wtset.getTileCount(); ii++) {
@@ -65,24 +69,6 @@ public class ScrollingScene implements DisplayMisoScene
return _tiles[tidx];
}
// documentation inherited from interface
public Tile getFringeTile (int x, int y)
{
return null;
}
// documentation inherited from interface
public void getSceneObjects (Rectangle region, ObjectSet set)
{
// nothing for now
}
// documentation inherited from interface
public boolean canTraverse (Object trav, int x, int y)
{
return true;
}
protected BaseTile[] _tiles;
protected Random _rand = new Random();
@@ -1,5 +1,5 @@
//
// $Id: ScrollingTestApp.java,v 1.19 2003/01/31 23:11:07 mdb Exp $
// $Id: ScrollingTestApp.java,v 1.20 2003/02/12 07:24:07 mdb Exp $
package com.threerings.miso.client;
@@ -113,7 +113,7 @@ public class ScrollingTestApp
if (_ship != null) {
_ship.setFollowingPathAction("sailing");
_ship.setRestingAction("sailing");
_ship.setActionSequence("sailing", true);
_ship.setActionSequence("sailing");
_ship.setLocation(_panel.getModel().bounds.width/2,
_panel.getModel().bounds.height/2);
_panel.addSprite(_ship);
@@ -146,15 +146,6 @@ public class ScrollingTestApp
int x = _ship.getX(), y = _ship.getY();
_ship.move(new LinePath(x, y, x, y + 1000, 3000l));
// set the scene to our scrolling scene
try {
_panel.setScene(new ScrollingScene(ctx));
} catch (Exception e) {
Log.warning("Error creating scene: " + e);
Log.logStackTrace(e);
}
// size and position the window, entering full-screen exclusive
// mode if available
if (gd.isFullScreenSupported()) {
@@ -168,6 +159,13 @@ public class ScrollingTestApp
_frame.setSize(200, 300);
SwingUtil.centerWindow(_frame);
}
try {
_panel.setScene(new ScrollingScene(ctx));
} catch (Exception e) {
Log.warning("Error creating scene: " + e);
Log.logStackTrace(e);
}
}
/**