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:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CharSpriteViz.java,v 1.3 2003/01/13 22:57:45 mdb Exp $
|
// $Id: CharSpriteViz.java,v 1.4 2003/02/12 07:24:07 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.cast;
|
package com.threerings.cast;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public class CharSpriteViz extends JPanel
|
|||||||
// put the sprite in the appropriate action mode
|
// put the sprite in the appropriate action mode
|
||||||
_sprite.setRestingAction(action);
|
_sprite.setRestingAction(action);
|
||||||
_sprite.setFollowingPathAction(action);
|
_sprite.setFollowingPathAction(action);
|
||||||
_sprite.setActionSequence(action, false);
|
_sprite.setActionSequence(action);
|
||||||
|
|
||||||
addMouseMotionListener(this);
|
addMouseMotionListener(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
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.
|
* Provides an infinite array of tiles in which to scroll.
|
||||||
*/
|
*/
|
||||||
public class ScrollingScene implements DisplayMisoScene
|
public class ScrollingScene extends VirtualDisplayMisoSceneImpl
|
||||||
{
|
{
|
||||||
public ScrollingScene (MisoContext ctx)
|
public ScrollingScene (MisoContext ctx)
|
||||||
throws NoSuchTileSetException, NoSuchTileException, PersistenceException
|
throws NoSuchTileSetException, NoSuchTileException, PersistenceException
|
||||||
@@ -34,21 +34,25 @@ public class ScrollingScene implements DisplayMisoScene
|
|||||||
// locate the water tileset
|
// locate the water tileset
|
||||||
TileSetRepository tsrepo = ctx.getTileManager().getTileSetRepository();
|
TileSetRepository tsrepo = ctx.getTileManager().getTileSetRepository();
|
||||||
Iterator iter = tsrepo.enumerateTileSets();
|
Iterator iter = tsrepo.enumerateTileSets();
|
||||||
TileSet wtset = null;
|
String tsname = null;
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
TileSet tset = (TileSet)iter.next();
|
TileSet tset = (TileSet)iter.next();
|
||||||
// yay for built-in regex support!
|
// yay for built-in regex support!
|
||||||
if (tset.getName().matches(".*[Ww]ater.*") &&
|
if (tset.getName().matches(".*[Ww]ater.*") &&
|
||||||
tset instanceof BaseTileSet) {
|
tset instanceof BaseTileSet) {
|
||||||
wtset = tset;
|
tsname = tset.getName();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wtset == null) {
|
if (tsname == null) {
|
||||||
throw new RuntimeException("Unable to locate water tileset.");
|
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
|
// grab our four repeating tiles
|
||||||
_tiles = new BaseTile[wtset.getTileCount()];
|
_tiles = new BaseTile[wtset.getTileCount()];
|
||||||
for (int ii = 0; ii < wtset.getTileCount(); ii++) {
|
for (int ii = 0; ii < wtset.getTileCount(); ii++) {
|
||||||
@@ -65,24 +69,6 @@ public class ScrollingScene implements DisplayMisoScene
|
|||||||
return _tiles[tidx];
|
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 BaseTile[] _tiles;
|
||||||
protected Random _rand = new Random();
|
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;
|
package com.threerings.miso.client;
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ public class ScrollingTestApp
|
|||||||
if (_ship != null) {
|
if (_ship != null) {
|
||||||
_ship.setFollowingPathAction("sailing");
|
_ship.setFollowingPathAction("sailing");
|
||||||
_ship.setRestingAction("sailing");
|
_ship.setRestingAction("sailing");
|
||||||
_ship.setActionSequence("sailing", true);
|
_ship.setActionSequence("sailing");
|
||||||
_ship.setLocation(_panel.getModel().bounds.width/2,
|
_ship.setLocation(_panel.getModel().bounds.width/2,
|
||||||
_panel.getModel().bounds.height/2);
|
_panel.getModel().bounds.height/2);
|
||||||
_panel.addSprite(_ship);
|
_panel.addSprite(_ship);
|
||||||
@@ -146,15 +146,6 @@ public class ScrollingTestApp
|
|||||||
int x = _ship.getX(), y = _ship.getY();
|
int x = _ship.getX(), y = _ship.getY();
|
||||||
_ship.move(new LinePath(x, y, x, y + 1000, 3000l));
|
_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
|
// size and position the window, entering full-screen exclusive
|
||||||
// mode if available
|
// mode if available
|
||||||
if (gd.isFullScreenSupported()) {
|
if (gd.isFullScreenSupported()) {
|
||||||
@@ -168,6 +159,13 @@ public class ScrollingTestApp
|
|||||||
_frame.setSize(200, 300);
|
_frame.setSize(200, 300);
|
||||||
SwingUtil.centerWindow(_frame);
|
SwingUtil.centerWindow(_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
_panel.setScene(new ScrollingScene(ctx));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.warning("Error creating scene: " + e);
|
||||||
|
Log.logStackTrace(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ViewerApp.java,v 1.36 2003/01/31 23:11:07 mdb Exp $
|
// $Id: ViewerApp.java,v 1.37 2003/02/12 07:24:08 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.viewer;
|
package com.threerings.miso.viewer;
|
||||||
|
|
||||||
@@ -21,10 +21,10 @@ import com.threerings.cast.CharacterManager;
|
|||||||
import com.threerings.cast.bundle.BundledComponentRepository;
|
import com.threerings.cast.bundle.BundledComponentRepository;
|
||||||
|
|
||||||
import com.threerings.miso.Log;
|
import com.threerings.miso.Log;
|
||||||
import com.threerings.miso.client.DisplayMisoSceneImpl;
|
import com.threerings.miso.client.SimpleDisplayMisoSceneImpl;
|
||||||
import com.threerings.miso.data.MisoSceneModel;
|
import com.threerings.miso.data.SimpleMisoSceneModel;
|
||||||
import com.threerings.miso.tile.MisoTileManager;
|
import com.threerings.miso.tile.MisoTileManager;
|
||||||
import com.threerings.miso.tools.xml.MisoSceneParser;
|
import com.threerings.miso.tools.xml.SimpleMisoSceneParser;
|
||||||
import com.threerings.miso.util.MisoContext;
|
import com.threerings.miso.util.MisoContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,14 +88,14 @@ public class ViewerApp
|
|||||||
|
|
||||||
// load up the scene specified by the user
|
// load up the scene specified by the user
|
||||||
try {
|
try {
|
||||||
MisoSceneParser parser = new MisoSceneParser("miso");
|
SimpleMisoSceneParser parser = new SimpleMisoSceneParser("miso");
|
||||||
MisoSceneModel model = parser.parseScene(args[0]);
|
SimpleMisoSceneModel model = parser.parseScene(args[0]);
|
||||||
if (model != null) {
|
if (model == null) {
|
||||||
_panel.setScene(new DisplayMisoSceneImpl(model, _tilemgr));
|
|
||||||
} else {
|
|
||||||
Log.warning("No miso scene found in scene file " +
|
Log.warning("No miso scene found in scene file " +
|
||||||
"[path=" + args[0] + "].");
|
"[path=" + args[0] + "].");
|
||||||
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
_panel.setScene(new SimpleDisplayMisoSceneImpl(model, _tilemgr));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.warning("Unable to parse scene [path=" + args[0] + "].");
|
Log.warning("Unable to parse scene [path=" + args[0] + "].");
|
||||||
@@ -165,7 +165,4 @@ public class ViewerApp
|
|||||||
|
|
||||||
/** The main panel. */
|
/** The main panel. */
|
||||||
protected ViewerSceneViewPanel _panel;
|
protected ViewerSceneViewPanel _panel;
|
||||||
|
|
||||||
/** The default scene to load and display. */
|
|
||||||
protected static final String DEF_SCENE = "rsrc/scenes/default.xml";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ViewerFrame.java,v 1.33 2002/04/27 02:34:29 mdb Exp $
|
// $Id: ViewerFrame.java,v 1.34 2003/02/12 07:24:08 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.viewer;
|
package com.threerings.miso.viewer;
|
||||||
|
|
||||||
@@ -7,6 +7,7 @@ import java.awt.BorderLayout;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.GraphicsConfiguration;
|
import java.awt.GraphicsConfiguration;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
@@ -63,5 +64,13 @@ public class ViewerFrame extends JFrame
|
|||||||
getContentPane().add(_panel, BorderLayout.CENTER);
|
getContentPane().add(_panel, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy callback method.
|
||||||
|
*/
|
||||||
|
public void handlePreferences (ActionEvent event)
|
||||||
|
{
|
||||||
|
System.err.println("Nothing doing!");
|
||||||
|
}
|
||||||
|
|
||||||
protected Component _panel;
|
protected Component _panel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ViewerSceneViewPanel.java,v 1.55 2003/01/31 23:11:07 mdb Exp $
|
// $Id: ViewerSceneViewPanel.java,v 1.56 2003/02/12 07:24:08 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.viewer;
|
package com.threerings.miso.viewer;
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
|
|||||||
CharacterSprite s = charmgr.getCharacter(desc);
|
CharacterSprite s = charmgr.getCharacter(desc);
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
// start 'em out standing
|
// start 'em out standing
|
||||||
s.setActionSequence(CharacterSprite.STANDING, false);
|
s.setActionSequence(CharacterSprite.STANDING);
|
||||||
s.setLocation(300, 300);
|
s.setLocation(300, 300);
|
||||||
s.addSpriteObserver(this);
|
s.addSpriteObserver(this);
|
||||||
spritemgr.addSprite(s);
|
spritemgr.addSprite(s);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: TestClient.java,v 1.14 2002/11/12 22:55:15 shaper Exp $
|
// $Id: TestClient.java,v 1.15 2003/02/12 07:24:08 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.whirled;
|
package com.threerings.whirled;
|
||||||
|
|
||||||
@@ -11,11 +11,15 @@ import com.threerings.presents.net.*;
|
|||||||
|
|
||||||
import com.threerings.crowd.Log;
|
import com.threerings.crowd.Log;
|
||||||
import com.threerings.crowd.client.*;
|
import com.threerings.crowd.client.*;
|
||||||
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
import com.threerings.whirled.client.SceneDirector;
|
import com.threerings.whirled.client.SceneDirector;
|
||||||
import com.threerings.whirled.client.DefaultDisplaySceneFactory;
|
|
||||||
import com.threerings.whirled.client.persist.SceneRepository;
|
import com.threerings.whirled.client.persist.SceneRepository;
|
||||||
|
import com.threerings.whirled.data.Scene;
|
||||||
|
import com.threerings.whirled.data.SceneImpl;
|
||||||
|
import com.threerings.whirled.data.SceneModel;
|
||||||
|
import com.threerings.whirled.util.SceneFactory;
|
||||||
import com.threerings.whirled.util.WhirledContext;
|
import com.threerings.whirled.util.WhirledContext;
|
||||||
|
|
||||||
public class TestClient
|
public class TestClient
|
||||||
@@ -31,8 +35,13 @@ public class TestClient
|
|||||||
_screp = new DummyClientSceneRepository();
|
_screp = new DummyClientSceneRepository();
|
||||||
_occdir = new OccupantDirector(_ctx);
|
_occdir = new OccupantDirector(_ctx);
|
||||||
_locdir = new LocationDirector(_ctx);
|
_locdir = new LocationDirector(_ctx);
|
||||||
_scdir = new SceneDirector(
|
|
||||||
_ctx, _locdir, _screp, new DefaultDisplaySceneFactory());
|
SceneFactory sfact = new SceneFactory() {
|
||||||
|
public Scene createScene (SceneModel model, PlaceConfig config) {
|
||||||
|
return new SceneImpl(model, config);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_scdir = new SceneDirector(_ctx, _locdir, _screp, sfact);
|
||||||
|
|
||||||
// we want to know about logon/logoff
|
// we want to know about logon/logoff
|
||||||
_client.addClientObserver(this);
|
_client.addClientObserver(this);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
//
|
//
|
||||||
// $Id: SpotSceneParserTest.java,v 1.3 2002/02/09 07:50:04 mdb Exp $
|
// $Id: SpotSceneParserTest.java,v 1.4 2003/02/12 07:24:08 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.whirled.tools.spot.xml;
|
package com.threerings.whirled.spot.tools.xml;
|
||||||
|
|
||||||
import com.samskivert.test.TestUtil;
|
import com.samskivert.test.TestUtil;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import com.threerings.whirled.tools.spot.EditableSpotScene;
|
import com.threerings.whirled.spot.data.SpotScene;
|
||||||
|
|
||||||
public class SpotSceneParserTest extends TestCase
|
public class SpotSceneParserTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -22,8 +22,8 @@ public class SpotSceneParserTest extends TestCase
|
|||||||
try {
|
try {
|
||||||
SpotSceneParser parser = new SpotSceneParser("scene");
|
SpotSceneParser parser = new SpotSceneParser("scene");
|
||||||
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
|
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
|
||||||
EditableSpotScene scene = parser.parseScene(tspath);
|
SpotScene scene = parser.parseScene(tspath);
|
||||||
// System.out.println("Parsed " + scene.getSpotSceneModel() + ".");
|
System.out.println("Parsed " + scene + ".");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -43,5 +43,5 @@ public class SpotSceneParserTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static final String TEST_SCENE_PATH =
|
protected static final String TEST_SCENE_PATH =
|
||||||
"rsrc/whirled/tools/spot/xml/scene.xml";
|
"rsrc/whirled/spot/tools/xml/scene.xml";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SceneParserTest.java,v 1.3 2002/02/09 07:50:04 mdb Exp $
|
// $Id: SceneParserTest.java,v 1.4 2003/02/12 07:24:08 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.whirled.tools.xml;
|
package com.threerings.whirled.tools.xml;
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import com.samskivert.test.TestUtil;
|
|||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import com.threerings.whirled.tools.EditableScene;
|
import com.threerings.whirled.data.Scene;
|
||||||
|
|
||||||
public class SceneParserTest extends TestCase
|
public class SceneParserTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -22,8 +22,8 @@ public class SceneParserTest extends TestCase
|
|||||||
try {
|
try {
|
||||||
SceneParser parser = new SceneParser("scene");
|
SceneParser parser = new SceneParser("scene");
|
||||||
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
|
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
|
||||||
EditableScene scene = parser.parseScene(tspath);
|
Scene scene = parser.parseScene(tspath);
|
||||||
// System.out.println("Parsed " + scene.getSceneModel() + ".");
|
System.out.println("Parsed " + scene + ".");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user