Wired things back up in the viewer now that we have a component

repository.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@647 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-11-27 08:49:58 +00:00
parent 7304609bc2
commit 28d53e469c
2 changed files with 24 additions and 11 deletions
@@ -1,5 +1,5 @@
// //
// $Id: ViewerApp.java,v 1.16 2001/11/21 02:42:16 mdb Exp $ // $Id: ViewerApp.java,v 1.17 2001/11/27 08:49:58 mdb Exp $
package com.threerings.miso.viewer; package com.threerings.miso.viewer;
@@ -12,9 +12,11 @@ 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.cast.CharacterManager; import com.threerings.cast.CharacterManager;
import com.threerings.cast.bundle.BundledComponentRepository;
import com.threerings.miso.Log; import com.threerings.miso.Log;
import com.threerings.miso.util.MisoContext; import com.threerings.miso.util.MisoContext;
import com.threerings.miso.util.MisoUtil;
/** /**
* The ViewerApp is a scene viewing application that allows for trying * The ViewerApp is a scene viewing application that allows for trying
@@ -26,27 +28,31 @@ public class ViewerApp
* Construct and initialize the ViewerApp object. * Construct and initialize the ViewerApp object.
*/ */
public ViewerApp (String[] args) public ViewerApp (String[] args)
throws IOException
{ {
// 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);
// bind our miso properties
MisoUtil.bindProperties(_config);
// create the context object // create the context object
MisoContext ctx = new ContextImpl(); MisoContext ctx = new ContextImpl();
// create the various managers // create the various managers
SpriteManager spritemgr = new SpriteManager(); SpriteManager spritemgr = new SpriteManager();
// XMLComponentRepository crepo = new XMLComponentRepository( BundledComponentRepository crepo =
// ctx.getConfig(), ctx.getImageManager()); new BundledComponentRepository(_rsrcmgr, "components");
CharacterManager charmgr = new CharacterManager(null); CharacterManager charmgr = new CharacterManager(crepo);
// create and size the main application frame // create and size the main application frame
_frame = new ViewerFrame(); _frame = new ViewerFrame();
_frame.setSize(WIDTH, HEIGHT); _frame.setSize(WIDTH, HEIGHT);
// create our scene view panel // create our scene view panel
_panel = new ViewerSceneViewPanel(ctx, spritemgr, charmgr); _panel = new ViewerSceneViewPanel(ctx, spritemgr, charmgr, crepo);
_frame.setPanel(_panel); _frame.setPanel(_panel);
// determine whether or not the user specified a scene to be // determine whether or not the user specified a scene to be
@@ -86,8 +92,13 @@ public class ViewerApp
*/ */
public static void main (String[] args) public static void main (String[] args)
{ {
ViewerApp app = new ViewerApp(args); try {
app.run(); ViewerApp app = new ViewerApp(args);
app.run();
} catch (IOException ioe) {
System.err.println("Error initializing viewer app.");
ioe.printStackTrace();
}
} }
/** The desired width and height for the main application window. */ /** The desired width and height for the main application window. */
@@ -1,5 +1,5 @@
// //
// $Id: ViewerSceneViewPanel.java,v 1.32 2001/11/27 08:06:57 mdb Exp $ // $Id: ViewerSceneViewPanel.java,v 1.33 2001/11/27 08:49:58 mdb Exp $
package com.threerings.miso.viewer; package com.threerings.miso.viewer;
@@ -11,6 +11,7 @@ import com.samskivert.util.Config;
import com.threerings.cast.CharacterDescriptor; import com.threerings.cast.CharacterDescriptor;
import com.threerings.cast.CharacterManager; import com.threerings.cast.CharacterManager;
import com.threerings.cast.ComponentRepository;
import com.threerings.cast.util.CastUtil; import com.threerings.cast.util.CastUtil;
import com.threerings.media.sprite.AnimationManager; import com.threerings.media.sprite.AnimationManager;
@@ -37,7 +38,8 @@ public class ViewerSceneViewPanel extends SceneViewPanel
* Construct the panel and initialize it with a context. * Construct the panel and initialize it with a context.
*/ */
public ViewerSceneViewPanel (MisoContext ctx, SpriteManager spritemgr, public ViewerSceneViewPanel (MisoContext ctx, SpriteManager spritemgr,
CharacterManager charmgr) CharacterManager charmgr,
ComponentRepository crepo)
{ {
super(ctx.getConfig(), spritemgr); super(ctx.getConfig(), spritemgr);
@@ -48,8 +50,8 @@ public class ViewerSceneViewPanel extends SceneViewPanel
charmgr.setCharacterClass(MisoCharacterSprite.class); charmgr.setCharacterClass(MisoCharacterSprite.class);
// create the character descriptors FIXME // create the character descriptors FIXME
_descUser = CastUtil.getRandomDescriptor(null); _descUser = CastUtil.getRandomDescriptor(crepo);
_descDecoy = CastUtil.getRandomDescriptor(null); _descDecoy = CastUtil.getRandomDescriptor(crepo);
// create the manipulable sprite // create the manipulable sprite
_sprite = createSprite(spritemgr, charmgr, _descUser); _sprite = createSprite(spritemgr, charmgr, _descUser);