Changes to jive with new rendering deal.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1288 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TestApp.java,v 1.12 2002/03/28 22:32:33 mdb Exp $
|
||||
// $Id: TestApp.java,v 1.13 2002/04/23 01:19:04 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
|
||||
@@ -8,8 +8,9 @@ import javax.swing.JFrame;
|
||||
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
|
||||
import com.threerings.resource.ResourceManager;
|
||||
import com.threerings.media.FrameManager;
|
||||
import com.threerings.media.ImageManager;
|
||||
import com.threerings.resource.ResourceManager;
|
||||
|
||||
import com.threerings.cast.Log;
|
||||
import com.threerings.cast.CharacterManager;
|
||||
@@ -27,6 +28,8 @@ public class TestApp
|
||||
_frame.setSize(800, 600);
|
||||
SwingUtil.centerWindow(_frame);
|
||||
|
||||
FrameManager framemgr = new FrameManager(_frame);
|
||||
|
||||
ResourceManager rmgr = new ResourceManager(
|
||||
"rsrc", null, "config/resource/manager.properties");
|
||||
ImageManager imgr = new ImageManager(rmgr, _frame);
|
||||
@@ -37,7 +40,7 @@ public class TestApp
|
||||
charmgr.setCharacterClass(MisoCharacterSprite.class);
|
||||
|
||||
// initialize the frame
|
||||
((TestFrame)_frame).init(charmgr, crepo);
|
||||
((TestFrame)_frame).init(framemgr, charmgr, crepo);
|
||||
}
|
||||
|
||||
public void run ()
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
//
|
||||
// $Id: TestFrame.java,v 1.4 2001/11/27 08:41:49 mdb Exp $
|
||||
// $Id: TestFrame.java,v 1.5 2002/04/23 01:19:04 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import com.threerings.media.FrameManager;
|
||||
|
||||
import com.threerings.cast.CharacterManager;
|
||||
import com.threerings.cast.ComponentRepository;
|
||||
|
||||
@@ -18,8 +20,9 @@ public class TestFrame extends JFrame
|
||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
}
|
||||
|
||||
public void init (CharacterManager charmgr, ComponentRepository crepo)
|
||||
public void init (FrameManager framemgr, CharacterManager charmgr,
|
||||
ComponentRepository crepo)
|
||||
{
|
||||
getContentPane().add(new BuilderPanel(charmgr, crepo));
|
||||
getContentPane().add(new BuilderPanel(framemgr, charmgr, crepo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ScrollingFrame.java,v 1.2 2002/02/19 07:21:33 mdb Exp $
|
||||
// $Id: ScrollingFrame.java,v 1.3 2002/04/23 01:19:04 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -8,7 +8,13 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.samskivert.swing.VGroupLayout;
|
||||
|
||||
import com.threerings.media.SafeScrollPane;
|
||||
|
||||
/**
|
||||
* The main application window.
|
||||
@@ -32,6 +38,19 @@ public class ScrollingFrame extends JFrame
|
||||
// set the frame and content panel background to black
|
||||
setBackground(Color.black);
|
||||
getContentPane().setBackground(Color.black);
|
||||
|
||||
// create some interface elements to go with our scrolling panel
|
||||
VGroupLayout vgl = new VGroupLayout(VGroupLayout.STRETCH);
|
||||
vgl.setOffAxisPolicy(VGroupLayout.STRETCH);
|
||||
getContentPane().setLayout(vgl);
|
||||
|
||||
vgl = new VGroupLayout(VGroupLayout.NONE);
|
||||
vgl.setOffAxisPolicy(VGroupLayout.STRETCH);
|
||||
JPanel stuff = new JPanel(vgl);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
stuff.add(new JButton("Button " + i));
|
||||
}
|
||||
getContentPane().add(new SafeScrollPane(stuff));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +65,7 @@ public class ScrollingFrame extends JFrame
|
||||
|
||||
// now add the new one
|
||||
_panel = panel;
|
||||
getContentPane().add(_panel, BorderLayout.CENTER);
|
||||
getContentPane().add(_panel, 0);
|
||||
}
|
||||
|
||||
protected Component _panel;
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
//
|
||||
// $Id: ScrollingScene.java,v 1.4 2002/04/15 17:47:05 mdb Exp $
|
||||
// $Id: ScrollingScene.java,v 1.5 2002/04/23 01:19:04 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import com.samskivert.io.PersistenceException;
|
||||
|
||||
import com.threerings.media.tile.NoSuchTileException;
|
||||
import com.threerings.media.tile.NoSuchTileSetException;
|
||||
import com.threerings.media.tile.ObjectTile;
|
||||
import com.threerings.media.tile.Tile;
|
||||
import com.threerings.media.tile.TileSet;
|
||||
import com.threerings.media.tile.TileSetRepository;
|
||||
|
||||
import com.threerings.miso.tile.BaseTile;
|
||||
import com.threerings.miso.util.MisoContext;
|
||||
@@ -19,14 +24,30 @@ import com.threerings.miso.util.MisoContext;
|
||||
public class ScrollingScene implements DisplayMisoScene
|
||||
{
|
||||
public ScrollingScene (MisoContext ctx)
|
||||
throws NoSuchTileSetException, NoSuchTileException
|
||||
throws NoSuchTileSetException, NoSuchTileException, PersistenceException
|
||||
{
|
||||
// locate the water tileset
|
||||
TileSetRepository tsrepo = ctx.getTileManager().getTileSetRepository();
|
||||
Iterator iter = tsrepo.enumerateTileSets();
|
||||
TileSet wtset = null;
|
||||
while (iter.hasNext()) {
|
||||
TileSet tset = (TileSet)iter.next();
|
||||
// yay for built-in regex support!
|
||||
if (tset.getName().matches(".*[Ww]ater.*")) {
|
||||
wtset = tset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (wtset == null) {
|
||||
throw new RuntimeException("Unable to locate water tileset.");
|
||||
}
|
||||
|
||||
// grab our four repeating tiles
|
||||
_tiles[0] = (BaseTile)ctx.getTileManager().getTile(5, 0);
|
||||
_tiles[1] = (BaseTile)ctx.getTileManager().getTile(5, 1);
|
||||
_tiles[2] = (BaseTile)ctx.getTileManager().getTile(5, 2);
|
||||
_tiles[3] = (BaseTile)ctx.getTileManager().getTile(5, 3);
|
||||
_tiles[4] = (BaseTile)ctx.getTileManager().getTile(5, 4);
|
||||
_tiles = new BaseTile[wtset.getTileCount()];
|
||||
for (int ii = 0; ii < wtset.getTileCount(); ii++) {
|
||||
_tiles[ii] = (BaseTile)wtset.getTile(ii);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
@@ -34,7 +55,7 @@ public class ScrollingScene implements DisplayMisoScene
|
||||
{
|
||||
long seed = ((x^y) ^ multiplier) & mask;
|
||||
long hash = (seed * multiplier + addend) & mask;
|
||||
int tidx = (int)((hash >> 10) % 5);
|
||||
int tidx = (int)((hash >> 10) % _tiles.length);
|
||||
return _tiles[tidx];
|
||||
}
|
||||
|
||||
@@ -56,10 +77,12 @@ public class ScrollingScene implements DisplayMisoScene
|
||||
return null;
|
||||
}
|
||||
|
||||
protected BaseTile[] _tiles = new BaseTile[5];
|
||||
protected BaseTile[] _tiles;
|
||||
protected Random _rand = new Random();
|
||||
|
||||
protected final static long multiplier = 0x5DEECE66DL;
|
||||
protected final static long addend = 0xBL;
|
||||
protected final static long mask = (1L << 48) - 1;
|
||||
|
||||
protected static final int WATER_TILESET_ID = 8;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ScrollingTestApp.java,v 1.10 2002/04/15 17:47:05 mdb Exp $
|
||||
// $Id: ScrollingTestApp.java,v 1.11 2002/04/23 01:19:04 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.samskivert.swing.util.SwingUtil;
|
||||
import com.samskivert.util.Config;
|
||||
|
||||
import com.threerings.resource.ResourceManager;
|
||||
import com.threerings.media.FrameManager;
|
||||
import com.threerings.media.ImageManager;
|
||||
|
||||
import com.threerings.media.sprite.Sprite;
|
||||
@@ -67,6 +68,9 @@ public class ScrollingTestApp
|
||||
// create the window
|
||||
_frame = new ScrollingFrame(gc);
|
||||
|
||||
// set up our frame manager
|
||||
_framemgr = new FrameManager(_frame);
|
||||
|
||||
// we don't need to configure anything
|
||||
ResourceManager rmgr = new ResourceManager(
|
||||
"rsrc", null, "config/resource/manager.properties");
|
||||
@@ -88,12 +92,7 @@ public class ScrollingTestApp
|
||||
charmgr.setCharacterClass(MisoCharacterSprite.class);
|
||||
|
||||
// create our scene view panel
|
||||
_panel = new SceneViewPanel(new IsoSceneViewModel()) {
|
||||
public void start () {
|
||||
super.start();
|
||||
// kick things off
|
||||
viewFinishedScrolling();
|
||||
}
|
||||
_panel = new SceneViewPanel(_framemgr, new IsoSceneViewModel()) {
|
||||
protected void viewFinishedScrolling () {
|
||||
// keep scrolling for a spell
|
||||
if (++_sidx < DX.length) {
|
||||
@@ -104,6 +103,7 @@ public class ScrollingTestApp
|
||||
protected final int[] DX = { 0, 1000, -1000, 1000, 2000 };
|
||||
protected final int[] DY = { 1000, 0, 1000, -1000, 1000 };
|
||||
};
|
||||
_panel.setScrolling(0, 1000, 10000l);
|
||||
_frame.setPanel(_panel);
|
||||
|
||||
// create our "ship" sprite
|
||||
@@ -131,7 +131,6 @@ public class ScrollingTestApp
|
||||
// set the scene to our scrolling scene
|
||||
try {
|
||||
_panel.setScene(new ScrollingScene(ctx));
|
||||
_panel.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.warning("Error creating scene: " + e);
|
||||
@@ -147,7 +146,8 @@ public class ScrollingTestApp
|
||||
|
||||
} else {
|
||||
Log.warning("Full-screen exclusive mode not available.");
|
||||
_frame.pack();
|
||||
// _frame.pack();
|
||||
_frame.setSize(200, 300);
|
||||
SwingUtil.centerWindow(_frame);
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,7 @@ public class ScrollingTestApp
|
||||
{
|
||||
// show the window
|
||||
_frame.show();
|
||||
_framemgr.start();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,6 +191,9 @@ public class ScrollingTestApp
|
||||
/** The tile manager object. */
|
||||
protected MisoTileManager _tilemgr;
|
||||
|
||||
/** The frame manager. */
|
||||
protected FrameManager _framemgr;
|
||||
|
||||
/** The main application window. */
|
||||
protected ScrollingFrame _frame;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ViewerApp.java,v 1.29 2002/04/06 02:03:54 mdb Exp $
|
||||
// $Id: ViewerApp.java,v 1.30 2002/04/23 01:19:04 mdb Exp $
|
||||
|
||||
package com.threerings.miso.viewer;
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.io.IOException;
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
|
||||
import com.threerings.resource.ResourceManager;
|
||||
import com.threerings.media.FrameManager;
|
||||
import com.threerings.media.ImageManager;
|
||||
|
||||
import com.threerings.media.tile.bundle.BundledTileSetRepository;
|
||||
@@ -64,6 +65,7 @@ public class ViewerApp
|
||||
|
||||
// create the window
|
||||
_frame = new ViewerFrame(gc);
|
||||
_framemgr = new FrameManager(_frame);
|
||||
|
||||
// we don't need to configure anything
|
||||
ResourceManager rmgr = new ResourceManager(
|
||||
@@ -83,7 +85,7 @@ public class ViewerApp
|
||||
charmgr.setCharacterClass(MisoCharacterSprite.class);
|
||||
|
||||
// create our scene view panel
|
||||
_panel = new ViewerSceneViewPanel(ctx, charmgr, crepo);
|
||||
_panel = new ViewerSceneViewPanel(ctx, _framemgr, charmgr, crepo);
|
||||
_frame.setPanel(_panel);
|
||||
|
||||
// load up the scene specified by the user
|
||||
@@ -136,6 +138,7 @@ public class ViewerApp
|
||||
{
|
||||
// show the window
|
||||
_frame.show();
|
||||
_framemgr.start();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,6 +158,9 @@ public class ViewerApp
|
||||
/** The tile manager object. */
|
||||
protected MisoTileManager _tilemgr;
|
||||
|
||||
/** The frame manager. */
|
||||
protected FrameManager _framemgr;
|
||||
|
||||
/** The main application window. */
|
||||
protected ViewerFrame _frame;
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
//
|
||||
// $Id: ViewerSceneViewPanel.java,v 1.47 2002/04/15 18:18:20 mdb Exp $
|
||||
// $Id: ViewerSceneViewPanel.java,v 1.48 2002/04/23 01:19:04 mdb Exp $
|
||||
|
||||
package com.threerings.miso.viewer;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.threerings.util.RandomUtil;
|
||||
import com.threerings.media.FrameManager;
|
||||
|
||||
import com.threerings.cast.CharacterDescriptor;
|
||||
import com.threerings.cast.CharacterManager;
|
||||
import com.threerings.cast.ComponentRepository;
|
||||
import com.threerings.cast.util.CastUtil;
|
||||
|
||||
import com.threerings.media.animation.AnimationManager;
|
||||
import com.threerings.media.sprite.LineSegmentPath;
|
||||
import com.threerings.media.sprite.PathCompletedEvent;
|
||||
import com.threerings.media.sprite.SpriteEvent;
|
||||
@@ -42,10 +41,11 @@ public class ViewerSceneViewPanel extends SceneViewPanel
|
||||
* Construct the panel and initialize it with a context.
|
||||
*/
|
||||
public ViewerSceneViewPanel (MisoContext ctx,
|
||||
FrameManager framemgr,
|
||||
CharacterManager charmgr,
|
||||
ComponentRepository crepo)
|
||||
{
|
||||
super(new IsoSceneViewModel());
|
||||
super(framemgr, new IsoSceneViewModel());
|
||||
|
||||
// create the character descriptors
|
||||
_descUser = CastUtil.getRandomDescriptor("female", crepo);
|
||||
@@ -123,9 +123,9 @@ public class ViewerSceneViewPanel extends SceneViewPanel
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void render (Graphics2D g, List invalidRects)
|
||||
public void paintBetween (Graphics2D g, Rectangle[] dirty)
|
||||
{
|
||||
super.render(g, invalidRects);
|
||||
super.paintBetween(g, dirty);
|
||||
PerformanceMonitor.tick(this, "paint");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user