Set up a bundled tileset repository and added code to parse a miso scene
file which is specified on the command line. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@686 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ViewerApp.java,v 1.17 2001/11/27 08:49:58 mdb Exp $
|
// $Id: ViewerApp.java,v 1.18 2001/11/29 20:31:53 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.viewer;
|
package com.threerings.miso.viewer;
|
||||||
|
|
||||||
@@ -9,12 +9,18 @@ import com.samskivert.swing.util.SwingUtil;
|
|||||||
import com.samskivert.util.Config;
|
import com.samskivert.util.Config;
|
||||||
|
|
||||||
import com.threerings.resource.ResourceManager;
|
import com.threerings.resource.ResourceManager;
|
||||||
|
|
||||||
import com.threerings.media.sprite.SpriteManager;
|
import com.threerings.media.sprite.SpriteManager;
|
||||||
import com.threerings.media.tile.TileManager;
|
import com.threerings.media.tile.TileManager;
|
||||||
|
import com.threerings.media.tile.bundle.BundledTileSetRepository;
|
||||||
|
|
||||||
import com.threerings.cast.CharacterManager;
|
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.scene.DisplayMisoSceneImpl;
|
||||||
|
import com.threerings.miso.scene.MisoSceneModel;
|
||||||
|
import com.threerings.miso.tools.scene.xml.MisoSceneParser;
|
||||||
import com.threerings.miso.util.MisoContext;
|
import com.threerings.miso.util.MisoContext;
|
||||||
import com.threerings.miso.util.MisoUtil;
|
import com.threerings.miso.util.MisoUtil;
|
||||||
|
|
||||||
@@ -30,10 +36,17 @@ public class ViewerApp
|
|||||||
public ViewerApp (String[] args)
|
public ViewerApp (String[] args)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
if (args.length < 1) {
|
||||||
|
System.err.println("Usage: ViewerApp scene_file.xml");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
// we don't need to configure anything
|
// we don't need to configure anything
|
||||||
_config = new Config();
|
_config = new Config();
|
||||||
_rsrcmgr = new ResourceManager(null, "rsrc");
|
_rsrcmgr = new ResourceManager(null, "rsrc");
|
||||||
_tilemgr = new TileManager(_rsrcmgr);
|
_tilemgr = new TileManager(_rsrcmgr);
|
||||||
|
_tilemgr.setTileSetRepository(
|
||||||
|
new BundledTileSetRepository(_rsrcmgr, "tilesets"));
|
||||||
|
|
||||||
// bind our miso properties
|
// bind our miso properties
|
||||||
MisoUtil.bindProperties(_config);
|
MisoUtil.bindProperties(_config);
|
||||||
@@ -55,8 +68,17 @@ public class ViewerApp
|
|||||||
_panel = new ViewerSceneViewPanel(ctx, spritemgr, charmgr, crepo);
|
_panel = new ViewerSceneViewPanel(ctx, spritemgr, charmgr, crepo);
|
||||||
_frame.setPanel(_panel);
|
_frame.setPanel(_panel);
|
||||||
|
|
||||||
// determine whether or not the user specified a scene to be
|
// load up the scene specified by the user
|
||||||
// displayed or if we'll be using the default
|
try {
|
||||||
|
MisoSceneParser parser = new MisoSceneParser("miso");
|
||||||
|
MisoSceneModel model = parser.parseScene(args[0]);
|
||||||
|
_panel.setScene(new DisplayMisoSceneImpl(model, _tilemgr));
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.warning("Unable to parse scene [path=" + args[0] + "].");
|
||||||
|
Log.logStackTrace(e);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user